我在Debian 7机器上安装docker的方法如下
$ 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
之后,当我第一次尝试创建一个图像时,它失败了,出现以下错误
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"
这是docker信息
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
如何增加内存?系统配置存储在哪里?
以下是卡尔的建议:
当我摆脱了所有的图像和容器,它确实释放了一些空间和图像构建运行更长的时间之前失败与相同的错误。问题是,这指的是哪个空间我怎么配置它?
我在RHEL机器上也遇到了这个问题。在堆栈溢出和docker-hub社区中,我没有找到任何合适的解决方案。
如果您在执行以下命令后仍面临此问题:
Docker系统全部修剪
最终奏效的解决方案:
docker info
To check current docker storage driver
Mine was : Storage Driver: devicemapper; If you have storage driver as overlay2 nothing to worry about. Solution will still work for you.
df -h
This is to check the available file systems on machine and the path where they are mounted.
Two mounted path to have a note:
/dev/mapper/rootvg-var 7.6G 1.2G 6.1G 16% /var
/dev/mapper/rootvg-apps 60G 9.2G 48G 17% /apps
Note- By default docker storage path is /var/lib/docker. It has available space ~6 GB and hence all the space related issues. So basically, I have to move default storage to some other storage where available space is more. For me its File sysyem path '/dev/mapper/rootvg-apps' which is mounted on /apps. Now task is to move /var/lib/docker to something like /apps/newdocker/docker.
mkdir /apps/newdocker/docker
chmod -R 777 /apps/newdocker/docker
Update docker.serive file on linux which resides under: /usr/lib/systemd/system
vi /usr/lib/systemd/system/docker.service
if storage device is devicemapper , comment existing ExecStart line and add below under [Service]:
ExecStart=
ExecStart=/usr/bin/dockerd -s devicemapper --storage-opt dm.fs=xfs --storage-opt dm.basesize=40GB -g /apps/newdocker/docker --exec-opt native.cgroupdriver=cgroupfs
Or if storage device is overlay2:
just add -g /apps/newdocker/docker in the existing ExexStart statement.
Something like ExecStart=/usr/bin/dockerd -g /apps/newdocker/docker -H fd:// --containerd=/run/containerd/containerd.sock
rm -rf /var/lib/docker (It will delete all existing docker data)
systemctl stop docker
ps aux | grep -i docker | grep -v grep
If no output has been produced by the above command, reload systemd daemon by below command.
systemctl daemon-reload
systemctl start docker
docker info
Check out the Data Space Available: 62.15GB after mouting to docker to new File system.
DONE
我在RHEL机器上也遇到了这个问题。在堆栈溢出和docker-hub社区中,我没有找到任何合适的解决方案。
如果您在执行以下命令后仍面临此问题:
Docker系统全部修剪
最终奏效的解决方案:
docker info
To check current docker storage driver
Mine was : Storage Driver: devicemapper; If you have storage driver as overlay2 nothing to worry about. Solution will still work for you.
df -h
This is to check the available file systems on machine and the path where they are mounted.
Two mounted path to have a note:
/dev/mapper/rootvg-var 7.6G 1.2G 6.1G 16% /var
/dev/mapper/rootvg-apps 60G 9.2G 48G 17% /apps
Note- By default docker storage path is /var/lib/docker. It has available space ~6 GB and hence all the space related issues. So basically, I have to move default storage to some other storage where available space is more. For me its File sysyem path '/dev/mapper/rootvg-apps' which is mounted on /apps. Now task is to move /var/lib/docker to something like /apps/newdocker/docker.
mkdir /apps/newdocker/docker
chmod -R 777 /apps/newdocker/docker
Update docker.serive file on linux which resides under: /usr/lib/systemd/system
vi /usr/lib/systemd/system/docker.service
if storage device is devicemapper , comment existing ExecStart line and add below under [Service]:
ExecStart=
ExecStart=/usr/bin/dockerd -s devicemapper --storage-opt dm.fs=xfs --storage-opt dm.basesize=40GB -g /apps/newdocker/docker --exec-opt native.cgroupdriver=cgroupfs
Or if storage device is overlay2:
just add -g /apps/newdocker/docker in the existing ExexStart statement.
Something like ExecStart=/usr/bin/dockerd -g /apps/newdocker/docker -H fd:// --containerd=/run/containerd/containerd.sock
rm -rf /var/lib/docker (It will delete all existing docker data)
systemctl stop docker
ps aux | grep -i docker | grep -v grep
If no output has been produced by the above command, reload systemd daemon by below command.
systemctl daemon-reload
systemctl start docker
docker info
Check out the Data Space Available: 62.15GB after mouting to docker to new File system.
DONE
不要只运行docker prune命令。它将删除所有的docker网络、容器和映像。所以你可能最终也会丢失重要的数据。
错误显示“设备上没有剩余空间”,所以我们只需要释放一些空间。
腾出空间最简单的方法就是删除悬空的图像。
当旧创建的图像不被使用时,这些图像被称为悬空图像或有一些缓存图像,以及你可以删除。
使用下面的命令。
列出所有悬挂图像。
docker images -f "dangling=true" -q
按映像id删除映像。
docker rmi IMAGE_ID
这样你就可以腾出一些空间,重新开始使用docker了:)