0

Im runing several docker containers on my raspberry pi. All containers are using named volumes to store persistent data. But since I often need to edit config files etc from the docker volumes I prefer to use path based volumes instead of named volumes that are managed by docker.

I first tought that I just could copy all the content from

/var/lib/docker/volumes/

to a folder on my home directory and remove all containers and rerun them with the new path based volumes. But unfortunately this seems not to work. For example if I rerun portainer with the new path based volume (which is just the folder that I copied from /var/lib/docker/volumes/ ) I need to create a new user etc. as if portainer could not use the copied data. I already used chown to add permissions for the current user.

Hope someone can help.

shyney
  • 67
  • 11
  • 1
    You shouldn't usually be looking in `/var/lib/docker` at all; the content there is fairly implementation-specific and isn't necessarily accessible on all platforms (though, yes, on native Linux, named volume content is in a basic flat-file directory). You can `docker run` a container to copy the content out as described in the linked question. – David Maze Feb 17 '21 at 15:30

1 Answers1

0

Ok I've noticed that in every folder of the named volumes is a extra folder called "_data" I had to copy all the content from that underlying folders to the proper folders to be able to run the containers with the data of the named volumes.

I still dont know if this is the "correct way" of migrating from named to path based volumes but at least it works now.

Why does docker even create a extra folder named _data instead of just using the folder of the named volume?

shyney
  • 67
  • 11