Docker Compose
- Compose file version 3 reference | Docker Docs
- Deprecated Version Key Version and name top-level element | Docker Documentation
Use Node to bootstrap your app
NPM Scripts don’t pass OS signals
CMD ['node','server.js']
Docker Networks Port Binding to specific network interfaces
If we bind the port with 8080:8080
, we actually bind the port from address
0.0.0.0
. This means the container can also listen to our Wifi.
To restrict it more, we can tell docker to expose the port on the loopback
network interface with 127.0.0.1:8080:8080
.
Docker Volumes mounting file permissions
When mounting directories into containers, permissions can become a problem.
- file systems that don’t support Linux permissions natively (such as NTFS without the
permission
mount option) break containers relying on permission settings - If the container starts with a user different to the host, owner problems can
arise. Fix by specifying the Hosts UID/GID in the compose file:
user: "1000:1001"
. - Volume mounting breaks host/container isolation. Consider a different approach.