Professional Documents
Culture Documents
Nginx
Nginx
Nginx
CHAPTER 6.3
Using Bind Mounts
Bind mounts have been around since the early days of Docker. They have limited
functionality compared to volumes. With bind mount, a file or directory on the host
machine is mounted into a container.
Volumes use a new directory that is created within Docker’s storage directory on
the host machine, and Docker manages that directory’s contents.
mkdir target
docker volume ls
Inspect the container to find the bind mount:
mkdir nginx
cat << EOF > nginx/nginx.conf
user nginx;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
EOF
Create an Nginx container that creates a bind mount to nginx.conf: