The Docker container ecosystem is full of really handy (and cool) tricks. One such trick is volumes, which allow you to deploy containers with persistent storage.

Deploy a second container that also uses the shared volume with the command: docker run -ti --rm -v shared-data:/shared-data ubuntu

In that file, paste the following: Deploy the first NGINX container with the command: docker run --name docker-nginx -p 8082:80 -d -v ~/nginx-data:/usr/share/nginx/html nginx

After the container deploys, point your web browser to http://SERVER:8083/index2.html (where SERVER is the IP address of your Docker server) and you should see the content of the second index file (Figure .

Related Articles