Using Volumes with Containers
Learn how to use volumes with containers.
We'll cover the following...
We'll cover the following...
Creating a container with a volume
Run the following command to create a new standalone container called voltainer that mounts a volume called bizvol.
$ docker run -it --name voltainer \--mount source=bizvol,target=/vol \alpine
Creating and running a container with a volume
The command specified the --mount flag, telling Docker to mount a volume called bizvol into the container at /vol. The command completed successfully even though you didn’t have a volume called bizvol. This raises an important point:
If you specify a volume that already exists, Docker will use it.
If you specify a volume that does not exist, ...