How to find Docker volume on host machine


Sometimes you may need to see the content of you Docker container data volume. Here I described an approach on how to do this.

 Imagine, you run a Docker container like this:

Now let’s go into this container:

And create a file there, then exit:

Now inspect the running container to find Source property which describes the data volume location of this Docker container:

You’ll see something like this as the output:

We’re especially interested in the Source property. Now if you ls the Source directory on your host machine that is running Docker:

On Linux you’ll see the contents of the volume, on Mac you’ll see: No such file or directory. This is because Docker on Mac is running inside a virtualized environment and the paths are relative to this sandboxed virtualized environment. All the containers which are stored within virtual environment are located at ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2. To go inside the VM use:

Then, being inside the virtual machine, execute:

You’ll see the contents of your Docker container data volume – the “yo” file.

Note: to exit the “screen”session, use CTRL-A, then CTRL-\.

Leave a Reply

Your email address will not be published. Required fields are marked *