Docker error : no space left on device

后端 未结 25 2955
悲哀的现实
悲哀的现实 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:50

    I had the same error and solve it this way:

    1 . Delete the orphaned volumes in Docker, you can use the built-in docker volume command. The built-in command also deletes any directory in /var/lib/docker/volumes that is not a volume so make sure you didn't put anything in there you want to save.

    Warning be very careful with this if you have some data you want to keep

    Cleanup:

    $ docker volume rm $(docker volume ls -qf dangling=true)
    

    Additional commands:

    List dangling volumes:

    $ docker volume ls -qf dangling=true
    

    List all volumes:

    $ docker volume ls
    

    2 . Also consider removing all the unused Images.

    First get rid of the images (those are sometimes generated while building an image and if for any reason the image building was interrupted, they stay there).

    here's a nice script I use to remove them

    docker rmi $(docker images | grep '^' | awk '{print $3}')
    

    Then if you are using Docker Compose to build Images locally for every project. You will end up with a lot of images usually named like your folder (example if your project folder named Hello, you will find images name Hello_blablabla). so also consider removing all these images

    you can edit the above script to remove them or remove them manually with

    docker rmi {image-name}

提交回复
热议问题