- Published on
How to See the Contents of a Docker Volume
- Authors
- Name
- Yair Mark
- @yairmark
Today I discovered a neat trick to view the contents of a volume with Docker as described here. This should work on any host environment - I tested this in Mac but see no reason why it should not work on other hosts.
Firstly to see what volumes you have run:
docker volume ls
To get more details about a particular volume from the list run:
docker volume inspect somevolumename
To actually see the contents of the volume run:
docker run -v somevolumename:/somevolumename -it ubuntu:19.04 bash
You should be logged in to an Ubuntu image that mounts this volume. From within the container to check what is in the volume simply run:
cd /somevolumename
You should now be inside the volume. This trick can also be used to mount a volume you may need to clean but cannot due to some other container that is stuck with some error.