Docker error : no space left on device

2019-01-20 21:18发布

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
$ sudo apt-get update
$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh

After that when I first tried creating an Image it failed with the following error

 time="2015-06-02T14:26:37-04:00" level=info msg="[8] System error: write /sys/fs/cgroup/docker/01f5670fbee1f6687f58f3a943b1e1bdaec2630197fa4da1b19cc3db7e3d3883/cgroup.procs: no space left on device"

Here is the docker info

Containers: 2
Images: 21
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 25
Dirperm1 Supported: true
Execution Driver: native-0.2
Kernel Version: 3.16.0-0.bpo.4-amd64
Operating System: Debian GNU/Linux 7 (wheezy)
CPUs: 2
 Total Memory: 15.7 GiB


WARNING: No memory limit support
 WARNING: No swap limit support

How can I increase the memory? Where are the system configurations stored?

From Kal's suggestions:

When I got rid of all the images and containers it did free some space and the image build ran longer before failing with the same error. So the question is, which space is this referring to and how do I configure it?

13条回答
\"骚年 ilove
2楼-- · 2019-01-20 21:30

Clean Docker by using the following command:

docker images --no-trunc | grep '<none>' | awk '{ print $3 }' \
| xargs docker rmi
查看更多
迷人小祖宗
3楼-- · 2019-01-20 21:33
  1. Clean dangled images docker rmi $(docker images -f "dangling=true" -q)
  2. Remove unwanted volumes
  3. Remove unused images
  4. Remove unused containers
查看更多
爷、活的狠高调
4楼-- · 2019-01-20 21:35

Seems like there are a few ways this can occur. The issue I had was that the docker disk image had hit its maximum size (Docker Whale -> Preferences -> Disk if you want to view what size that is in OSX).

I upped the limit and and was good to go. I'm sure cleaning up unused images would work as well.

查看更多
5楼-- · 2019-01-20 21:36

you can also use:

docker system prune

or for just volumes:

docker volume prune
查看更多
Juvenile、少年°
6楼-- · 2019-01-20 21:38

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 <none> 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 '^<none>' | 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}

查看更多
混吃等死
7楼-- · 2019-01-20 21:41

UPDATE
The commands below have become hacks as Docker becomes more developed. The current best practice is

docker system prune

This 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

As below, this is nuclear.


To clean your system, first remove containers

$ docker rm $(docker ps -aq)

then remove images

$ docker rmi $(docker images -q)

This is of course nuclear and will remove all containers and all images. You can remove them one at at time via docker rm #CONTAINER_ID# and docker rmi #IMAGE_ID.

查看更多
登录 后发表回答