How can I fix the "No space on device" error in Docker?

I am running Mac-native Docker (without virtual boxing / docker machine).

I have a huge image with a lot of infrastructure in it (Postgres, etc.). I have cleaning scripts to get rid of a lot of cracks - unused images, etc.

When I launch my image, I get an error message:

could not create directory "/var/lib/postgresql/data/pg_xlog": No space left on device 

On my host, Mac / var is at 60% available space, and usually there is a lot of free space on my disk.

Is this some kind of Docker configuration, do I need to raise it to give it more resources?

Relevant lines from mount inside docker:

 none on / type aufs (rw,relatime,si=5b19fc7476f7db86,dio,dirperm1) /dev/vda1 on /data type ext4 (rw,relatime,data=ordered) /dev/vda1 on /etc/resolv.conf type ext4 (rw,relatime,data=ordered) /dev/vda1 on /etc/hostname type ext4 (rw,relatime,data=ordered) /dev/vda1 on /etc/hosts type ext4 (rw,relatime,data=ordered) /dev/vda1 on /var/lib/postgresql/data type ext4 (rw,relatime,data=ordered) 

Heres df :

 [11:14] Filesystem 1K-blocks Used Available Use% Mounted on none 202054928 4333016 187269304 3% / tmpfs 1022788 0 1022788 0% /dev tmpfs 1022788 0 1022788 0% /sys/fs/cgroup /dev/vda1 202054928 4333016 187269304 3% /data shm 65536 4 65532 1% /dev/shm tmpfs 204560 284 204276 1% /run/docker.sock 
+6
source share
2 answers

Recently, I came across installing docker on Linux, which uses the devicemapper storage devicemapper (default). There really was a docker configuration that I needed to change in order to fix this.

Docker images consist of read-only file system snapshot levels, each of which is created by a command in the Dockerfile , which is built on top of a common snapshot of the base memory. The base snapshot is shared by all of your images and has a file system with a default size of 10 GB. When you launch your image, you get a new recordable layer on top of all image layers, so you can add new files to your running container, but ultimately it is based on the same basic snapshot with a 10 GB file system. This is at least true for devicemapper and not for other drivers. Here is the relevant documentation from docker.

To change this default value to something else, you can set the daemon parameter, for example. docker daemon --storage-opt dm.basesize=100G . Since you probably do not start the daemon manually, you need to edit the docker daemon settings in some file, depending on how you launch the docker daemon. With docker for mac, you can edit daemon parameters as JSON in the settings in Daemon->Advanced . You probably need to add something like this:

 { "storage-opts": ["dm.basesize=100G"] } 

(but, as I said, I had this problem on Linux, so I have not tried the above).

In any case, for this to take effect, you need to delete all existing images (so that they are recreated on top of the new base snapshot with a new size). See storage driver options .

+1
source

I did not find many options for this, the main problem on github is https://github.com/docker/for-mac/issues/371

Some of the suggested options are:

  • If you can delete all images / containers, you can follow these instructions:

docker rm $(docker ps -a -q) docker rmi $(docker images -q) docker volume rm $(docker volume ls |awk '{print $2}') rm -rf ~/Library/Containers/com.docker.docker/Data/*

  • You can try cropping all unused images / containers, but this turned out to be not very efficient:

docker system prune

See also: How do you get around the Docker.qcow2 size limit in Docker for Mac? And https://forums.docker.com/t/no-space-left-on-device-error/10894/26

0
source

Source: https://habr.com/ru/post/1013298/


All Articles