Variables, Volumes, and DockerHub
Learn how to use environment variables, mount volumes, and upload the images to DockerHub.
In this lesson, we will dive further into the different configurations of Docker containers.
Mount volumes
Your Ansible environment is ready, but you have to use nano
or some other editor to make changes to the files that are local to the container. Any change made outside the container has to be replicated inside the container as well.
That’s where mounted volumes come in. Docker allows you to mount a local directory to a directory inside the container.
You can mount a directory using the --volume
option. The syntax for mounting a directory is --volume {host directory}:{container directory}
Image Destroyed!
In case you are returning to this lesson later than when you built the image, there is a chance that the image is destroyed, so you will have to run thebuild
command again before executing therun
command. Rundocker images
to make sure the image exists.
Run the following command below in the terminal:
Get hands-on with 1200+ tech skills courses.