Docker error : no space left on device

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

    If it's just a test installation of Docker (ie not production) and you don't care about doing a nuclear clean, you can:

    clean all containers: docker ps -a | sed '1 d' | awk '{print $1}' | xargs -L1 docker rm

    clean all images: docker images -a | sed '1 d' | awk '{print $3}' | xargs -L1 docker rmi -f

    Again, I use this in my ec2 instances when developing Docker, not in any serious QA or Production path. The great thing is that if you have your Dockerfile(s), it's easy to rebuild and or docker pull.

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

    As already mentioned,

    docker system prune
    

    helps, but with Docker 17.06.1 and later without pruning unused volumes. Since Docker 17.06.1, the following command prunes volumes, too:

    docker system prune --volumes
    

    From the Docker documentation: https://docs.docker.com/config/pruning/

    The docker system prune command is a shortcut that prunes images, containers, and networks. In Docker 17.06.0 and earlier, volumes are also pruned. In Docker 17.06.1 and higher, you must specify the --volumes flag for docker system prune to prune volumes.

    If you want to prune volumes and keep images and containers:

    docker volume prune
    
    0 讨论(0)
  • 2020-11-28 00:30

    I run the below commands.

    There is no need to rebuilt images afterwards.

    docker rm $(docker ps -qf 'status=exited')
    docker rmi $(docker images -qf "dangling=true")
    docker volume rm $(docker volume ls -qf dangling=true)
    

    These remove exited/dangling containers and dangling volumes.

    0 讨论(0)
  • 2020-11-28 00:30
    $ docker rm $(docker ps -aq)
    

    This worked for me

    docker system prune 
    

    appears to be better option with latest version

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

    I just ran into this. I'm on Ubuntu 20.04. What worked? Reinstalling Docker:

    sudo apt-get purge docker-ce docker-ce-cli containerd.io
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    

    A bit crude, I know. I tried pruning Docker, but it still would not work.

    0 讨论(0)
  • 2020-11-28 00:37
    1. Clean dangled images docker rmi $(docker images -f "dangling=true" -q)
    2. Remove unwanted volumes
    3. Remove unused images
    4. Remove unused containers
    0 讨论(0)
提交回复
热议问题