Hi,
I have a Docker compose file in which I define named volumes that my containers use. Recently I ran out of disk space on my VPS and decided to add an external storage medium to the system, and use that as the location for one of the Docker compose defined named volumes (used for backups on my system).
I bound the named volume to the external storage medium, and am able to see files that get placed inside the volume show up on the external storage medium. So far so good.
However, it looks like the files are still being placed on the main system disk (under /var/lib/docker/volumes/docker_vol-backups
), which beats the whole purpose of storing the files on an external drive.
Here is the relevant part of where the volume is defined inside the Docker compose file:
...
volumes:
vol-backups:
driver: local
driver_opts:
type: none
o: bind
device: ${DOCKER_VOL_BACKUPS_PATH}
...
The path variable DOCKER_VOL_BACKUPS_PATH
is defined inside a .env file stored along side the Docker compose file, and points to the mountpoint /mnt/backups
.
Here is a composite screenshot of ncdu
showing the size of var
and mnt
before and after a having run docker compose up
and then triggered a backup operation which places a 8.7 GiB archive file on the vol-backups
volume.
The archive file counts towards both the storage on /mnt/backups
and on the main system disk (under /var/lib/docker
)
Am I doing something wrong with the binding, or is this working as intended?
All help in debugging this would be most appreciated.