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:
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:
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.