I’ve been using portainer to set up various docker containers and stacks. I recently set up a deluge container, which after being halfway through a large download, threw an error stating that there was no more space left on the machine for saving torrent info.
The stack uses two mounted volumes that point to a mounted CIFS drive of 1TB like so:
version: "3.1"
services:
deluge:
image: lscr.io/linuxserver/deluge:latest
container_name: deluge
environment:
- PUID=1001
- PGID=1001
- DELUGE_LOGLEVEL=error #optional
volumes:
- /mnt/sbox1/docker/deluge/config:/config
- /mnt/sbox1/docker/deluge/downloads:/downloads
ports:
- 8112:8112
- 6881:6881
- 6881:6881/udp
restart: unless-stopped
This seemed strange to me since the error was pointing to a file in a /tmp
directory that was not present in the host machine, so I run the ls -lh /tmp
command inside the container and found it. From what I understand, since docker is installed inside the host’s /var/lib/docker directory, any containers that I set up, will be using the host for any /tmp
data and in cases such as this, that won’t suffice. What are my options here? I tried running docker-compose up
on the mounted /mnt/sbox1/docker/deluge
dir, but since it uses the host’s docker, it fails with the same issue.
Can I somehow specify to docker (through Portainer preferably) that I want a container to use the storage space on the new mounted drive instead of the space on the host? Would something like adding a mapping to the container’s /tmp
path suffice?
2
Answers
Thankfully, I managed to fix it, along with @Pierre B.'s help. It seems like the position of the
vers=3.0
argument matters (I wasn't aware), and after moving it to the left instead of the end of thefstab
entry, it worked and is now mounting as expected during startup. Here's my/etc/fstab
entry:After editing it, performing a
reboot
ormount -a
fixed everything up and nowdmesg | grep CIFS
doesn't show any errors.Indeed you can setup your
docker-compose.yml
to mount container’s/tmp
on your large disk, for example:It looks like you’re using a
docker-compose.yml
file, in that case I would advise against your container directly in Portainer directly (appart for debugging purposes): any change in yourdocker-compose.yml
would re-create container with previous volume definition.Appart from mounting a volume, you can:
/var/lib/docker
using--data-root
flag, but that seems overly complex for your problem (you would have either to re-install Docker or move all data into new directory)/downloads/tmp
. But using Docker volume config seems the simpler way in your case, such patterns for mounting/tmp
are quite common.EDIT: to answer comment
Indeed, as you said every Docker container’s data is stored under
/var/lib/docker
by default. This will include all data written into your container writable layer unless they’re bind-mounted (volumes will also be created under/var/lib/docker/volumes
). In other words, everything in your container/
will be somewhere in/var/lib/docker/...
.Your container probably writes somewhere – like
/tmp
and other directories – while downloading, that’s why you see such disk usage. You can try to debug while downloading usingdu -sh /*
or such in your container to identify disk usage.