How do i mount a docker volume from the host system to the container?
-
Man page for docker rm: http://bit.ly/2zgpToW
Sometimes you might have directory on the host system which you want to mount on the container.
Run a container with a volume from the host system.
$ docker run --name workshop2 -v $(pwd)/workshop_files:/workshop_files alpine touch /workshop_files/myworkshopnotes
Remove the container. Removing it because it not needed for this demo.
$ docker rm workshop2
List the file created in the first step, shows that the host data area created the file when the container was launched with the volume.
$ ls workshop_files/ myworkshopnotes
© Lightnetics 2024