How do i share a container volume with other containers?
-
Man page for docker create: http://bit.ly/2j5l6jT
Man page for docker run: http://bit.ly/2h77MqODocker documentation on docker create: https://docs.docker.com/engine/reference/commandline/create/
Docker documentation on docker run: https://docs.docker.com/engine/reference/commandline/run/This is where you have on container with a data volume and you want to have other containers share that volume.
Create a container, with a volume.
$ docker create --name workshop -v /shared-vol alpine who
Create a file in volume from another container.
$ docker run --name TestvolA --volumes-from workshop alpine touch /shared-vol/testvola
List the the files in the /shared-vol.
$ docker run --name TestvolB --volumes-from workshop alpine ls /shared-vol testvola
© Lightnetics 2024