Home > Blockchain >  Where to find the docker volume on Windows
Where to find the docker volume on Windows

Time:11-19

My understanding of a docker-volume is that it is some storage on my local machine, which different docker containers running on my local machine as well, can access.

I have used a docker-compose.yml to create a docker container running a postgres database. I specified the volume path as 'postgres:/var/lib/postgresql/data'. This seems to be a Linux path, however. I assume that Linux is the OS running in my container and somehow docker knows where to look for the actual data on my Windows machine. Can someone tell me what would be the Windows path to this volume file?

I have specified the name of the volume as 'postgres'. When I list the existing volumes on my local machine using 'docker volume ls', however, I can only see one named volume called 'docker_postgres'. I have read that docker preprends the volume name with the project directory that it is stored in. That's one of the reasons I would like to find the location of the volume on my local machine - simply because I cannot comprehend why the prefix is 'docker'.

You probably realized I don't have a broad background on docker, please help me out with an explanation!

CodePudding user response:

Can someone tell me what would be the Windows path to this volume file?

Yes, someone could (I can't, I don't know the internals well enough), but that would be circumventing how docker volumes are meant to be used.

If you want to access your data from outside containers, you would simply not use a named volume, but directly use a path instead of the postgres volume name.

If you need to access the data nevertheless, mounting the volume in a container that gives your host access to the data (e.g. through SSH/SCP) is the canonical way of doing this.

  • Related