Docker 1.9 added named volumes, so I..
docker volume create --name postgres-data docker volume ls
and I get
local postgres-data
all good so far..
so how do I see what is in the named volume? Is there a way to cd to it on the host system. Like I can for a mounted host directory?
View a Data Volume You can use the docker volume ls command to view a list of data volumes. Use the docker volume inspect command to view the data volume details.
docker volume ls | Docker Documentation.
When you run docker inspect myContainer , the Volumes and VolumesRW fields give you information about ALL of the volumes mounted inside a container, including volumes mounted in both the Dockerfile with the VOLUME directive, and on the command line with the docker run -v command.
docker run --rm -i -v=postgres-data:/tmp/myvolume busybox find /tmp/myvolume
Explanation: Create a minimal container with tools to see the volume's files (busybox), mount the named volume on a container's directory (v=postgres-data:/tmp/myvolume
), list the volume's files (find /tmp/myvolume
). Remove the container when the listing is done (--rm
).
you can run docker volume inspect postgres-data
and see Mountpoint
section of the result
therefore source parameter will point to host directory maybe /var/lib/docker/volumes/[volume_name]/_data
directory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With