Last edited:
This thread got me wondering how Docker on DSM manages container data when the persistent/generated data is not mapped to a DSM folder.
Having read this Manage data in Docker and then poked around inside DSM I find that 'volumes' are located here:
I created a new container from an image (postgresql) and noted that a new folder is created in
I then stopped the container and did the Clear action: nothing happened to the data (ok the folder hierarchy), but a new empty folder in
So what to think?
So while Docker docs say that they recommend using volumes over bind mounts, unless it can be otherwise argued, I'd lean towards using bind mounts for container data ... until DSM Docker provides a more transparent method to manage volumes, both deleting obsolete volumes and re-attaching volumes to cleaned containers.
I'd be really interested in anyone's thoughts on this.
Edit:
Read the Docker docs, took a gamble and ran
Having read this Manage data in Docker and then poked around inside DSM I find that 'volumes' are located here:
/volume1/@appstore/Docker/docker/volumes/
which is a link to /volume1/@docker/volumes
. In this folder I have 45 'volume' folders for five containers.I created a new container from an image (postgresql) and noted that a new folder is created in
.../volumes
. When the container runs the psql DB folder hierarchy is created in subfolder _data
.I then stopped the container and did the Clear action: nothing happened to the data (ok the folder hierarchy), but a new empty folder in
.../volumes
was now created. When I ran the cleaned container it was in here that a new set of psql DB folders were created.So what to think?
- DSM's Clear action dissociates a container from its current Docker volume (and data).
- It's not easy to associate a container to a volume folder (random-unique folder names), so copying data from one Docker volume to another is guesswork.
- DSM's Clear action doesn't actually delete all container data as it claims: it just creates a growing archive of old folders.
- There's a reason Clear doesn't delete old volume folders and that's because Docker (not just DSM's implementation) allows containers to access other volumes and there's probably no map of when a volume folder is no longer required.
- Be aware that containers might store sensitive data in these forgotten folders.
So while Docker docs say that they recommend using volumes over bind mounts, unless it can be otherwise argued, I'd lean towards using bind mounts for container data ... until DSM Docker provides a more transparent method to manage volumes, both deleting obsolete volumes and re-attaching volumes to cleaned containers.
I'd be really interested in anyone's thoughts on this.
Edit:
Read the Docker docs, took a gamble and ran
sudo docker volume prune
. It removed all but two volume folders and recovered 300MB of space ... mostly psql DB and sqlite DB files.