Docker error : no space left on device

后端 未结 25 2761
悲哀的现实
悲哀的现实 2020-11-28 00:01

I installed docker on a Debian 7 machine in the following way

$ echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
$          


        
相关标签:
25条回答
  • 2020-11-28 00:39

    Your cgroups have the cpuset controller enabled. This controller is mostly useful in NUMA environment where it allows to finely specify which CPU/memory bank your tasks are allowed to run.

    By default the mandatory cpuset.mems and cpuset.cpus are not set which means that there is "no space left" for your task, hence the error.

    The easiest way to fix this is to enable cgroup.clone_children to 1 in the root cgroup. In your case, it should be

    echo 1 > /sys/fs/cgroup/docker/cgroup.clone_children
    

    It will basically instruct the system to automatically initialize container's cpuset.mems and cpuset.cpus from their parent cgroup.

    0 讨论(0)
  • 2020-11-28 00:40

    Check that you have free space on /var as this is where Docker stores the image files by default (in /var/lib/docker).

    First clean stuff up by using docker ps -a to list all containers (including stopped ones) and docker rm to remove them; then use docker images to list all the images you have stored and docker rmi to remove them.

    Next change the storage location with a -g option on the docker daemon or by editing /etc/default/docker and adding the -g option to DOCKER_OPTS. -g specifies the location of the "Docker runtime" which is basically all the stuff that Docker creates as you build images and run containers. Choose a location with plenty of space as the disk space used will tend to grow over time. If you edit /etc/default/docker, you will need to restart the docker daemon for the change to take effect.

    Now you should be able to create a new image (or pull one from Docker Hub) and you should see a bunch of files getting created in the directory you specified with the -g option.

    0 讨论(0)
  • 2020-11-28 00:40

    1. Remove Containers:

    $ docker rm $(docker ps -aq)

    2. Remove Images:

    $ docker rmi $(docker images -q)

    Instead of perform steps 1 and 2 you can do:

    docker system prune

    This command will remove:

    • All stopped containers
    • All volumes not used by at least one container
    • All networks not used by at least one container
    • All dangling images
    0 讨论(0)
  • 2020-11-28 00:41

    Its may be due to the default storage space set to 40GB ( default path , /var/lib/docker)

    you can change the storage volume to point to different path

    • edit file -> /etc/sysconfig/docker-storage
    • update below line (add if not exists)

    DOCKER_STORAGE_OPTIONS='--storage-driver=overlay --graph=CUSTOM_PATH'

    • Restart docker systemctl stop docker systemctl daemon-reload systemctl start docker

    if you run command docker info ( it should show storage driver as overlay)

    0 讨论(0)
  • 2020-11-28 00:44

    In my case I didn't have so many images/containers, but the build cache was filling up my Docker Disk.

    You can see that this is the problem by running

    docker system df
    

    Output:

    TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
    Images              22                  13                  7.581GB             3.899GB (51%)
    Containers          15                  0                   2.166GB             2.166GB (100%)
    Local Volumes       4                   4                   550.2MB             0B (0%)
    Build Cache         611                 0                   43.83GB             43.83GB!!!!!!!!!
    

    The command below solves that issue

    docker builder prune
    
    0 讨论(0)
  • In my case installation of ubuntu-server 18.04.1 [for some weird reason] created an LVM logical volume with just 4GBs in size instead of 750GBs. Therefore when pulling images i would get this "no space left on device" error. The fix is simple:

    lvextend -l 100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
    resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
    
    0 讨论(0)
提交回复
热议问题