ALU
ALU

Reputation: 374

Docker does not see all disks - No space left on device

If i run

df -h

inside the Dockerfile of an image I want to build, it sees:

Filesystem      Size  Used Avail Use% Mounted on
overlay         118G  112G     0 100% /
tmpfs            64M     0   64M   0% /dev
tmpfs            16G     0   16G   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/sda1       118G  112G     0 100% /etc/hosts
tmpfs            16G     0   16G   0% /proc/asound
tmpfs            16G     0   16G   0% /proc/acpi
tmpfs            16G     0   16G   0% /proc/scsi
tmpfs            16G     0   16G   0% /sys/firmware

but if I run it outside, it sees:

Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  355M  2.8G  12% /run
/dev/sda1       118G  112G     0 100% /
tmpfs            16G  300M   16G   2% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sda3       308G  4.8G  288G   2% /mnt/ssd
/dev/sdb1       1.8T  1.2T  605G  66% /home
tmpfs           3.2G   16K  3.2G   1% /run/user/1002
tmpfs           3.2G  4.0K  3.2G   1% /run/user/1038
tmpfs           3.2G     0  3.2G   0% /run/user/1037
/dev/loop1       97M   97M     0 100% /snap/core/9436
/dev/loop0       97M   97M     0 100% /snap/core/9665
/dev/loop3      163M  163M     0 100% /snap/blender/42
/dev/loop2      163M  163M     0 100% /snap/blender/43
tmpfs           3.2G     0  3.2G   0% /run/user/1039

I got error "No space left on device" and I would like to use my /dev/sdb1 disk with 600 free GB, why docker does not see it? How can I make it use that space?

Upvotes: 1

Views: 520

Answers (1)

larsks
larsks

Reputation: 312500

Docker -- absent explicit configuration to the contrary -- stores container data in /var/lib/docker. If you want to expand the space available to your Docker containers, one solution would be to mount a filesystem from /dev/sdb onto /var/lib/docker.

Alternately, you can configure Docker to store container data in a different location by setting the data-root option in your /etc/docker/daemon.json file, as described in the dockerd documentation.

For example:

{
  "data-root": "/home/docker"
}

In either case, you may want to copy existing files from /var/lib/docker into the new location; otherwise, Docker will not see any of your existing images, containers, volumes, etc after you make the change.

Upvotes: 3

Related Questions