I am trying to persist the entire configuration folder of an application on the host system but I noticed that only partial content is written. I cannot locate some of the files under the /var/lib/docker/volumes/ folder. Following is the command I run:
# docker volume create etcsalt
# docker run --name salt --hostname salt -p 4505-4506:4505-4506 -p 8000:8000 -e SALT_SHARED_SECRET=mysecretpassword --ulimit nofile=90000:90000 --mount source=etcsalt,target=/etc/salt -d saltstack/salt:3004.2
I think the following link shows the Dockerfile for the project:
Once the container starts, I check the content of the volume:
root@test:/var/lib/docker/volumes/etcsalt/_data# ls
master.d minion.d pki proxy.d
master.d folder has a couple of files I am looking. The rest of the folders are blank. This is not the case when I check the same folders inside the container.
I just noticed that when I create a different mount point for each subfolder and run the docker with multiple mount points, I see the files I am looking. I can stop and remove the active docker container and start a new one and everything works as expected.
If you look into the Dockerfile you linked, you cans ee this line:
VOLUME /etc/salt/pki/
You mounted /etc/salt and I guess the volume defined in the Dockerfile was mounted over it. Since you havenāt defined any volume with the same destination path (the path after the VOLUME instruction in Dockerfile) Docker created an anonymous volume ( its name is a hash ) so the content of the āpkiā folder was saved there.
I donāt know about the rest of the folders. I guess those folders were empty even when you mounted multiple volumes.
This is why I donāt like to use the VOLUME instruction in the Dockerfile as you canāt undo it.