August 2017
Intermediate to advanced
278 pages
8h 53m
English
Our initial example is fairly basic, but can be easily extended to serve static files. Rather than building an image with the files deployed, we can map a volume to the host in which Docker is on. This way, we can edit the files locally but still have them served from within the Docker container. Here's our updated run command:
docker run --name nginx-basic -d -p 81:80 -v /var/static:/usr/share/nginx/html:ro nginx
Docker's filesystems use a union filesystem (for example, OverlayFS); this allows you to join two systems at a specified mount point. In our preceding example, we mounted /var/static on our local server and specified the mount point as /usr/share/nginx/html. We've also specified that the mount is read-only to prevent ...
Read now
Unlock full access