Docker Community Forums

Share and learn in the Docker community.

Access volume files from the host

I have a container that is using a db stored in /app/db. The /db folder as well as everything inside it is stored inside a volume to make it persistent. I have used sudo docker run -v db_volume:/app/db -it --privileged accumulator to run it

Now, if I try to copy the content of the volume in my Documents folder and try to access the .db, I can’t because Ubuntu says I have no permissions.

From what I have understood the only permitted entity to access, read and write the file inside the volume attached to the container is the container itself.

Is there a way to grant my Ubuntu user access of the .db as I need to analyze it with a db viewer software?

Nobody?

I can’t believe I’m the first person to need access to a volume from the host user…

Ok the solution was to simply copy the content with

docker cp container_name:/path/of/the/database.db .