我在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
如何增加内存?系统配置存储在哪里?
以下是卡尔的建议:
当我摆脱了所有的图像和容器,它确实释放了一些空间和图像构建运行更长的时间之前失败与相同的错误。问题是,这指的是哪个空间我怎么配置它?
检查/var上是否有空闲空间,因为Docker默认将图像文件存储在/var/lib/ Docker中。
首先使用docker ps -a列出所有容器(包括停止的容器),然后使用docker rm删除它们;然后使用docker images列出您存储的所有映像,并使用docker rmi删除它们。
接下来,在docker守护进程上使用-g选项更改存储位置,或者编辑/etc/default/docker并将-g选项添加到DOCKER_OPTS。-g指定“Docker运行时”的位置,这基本上是Docker在构建映像和运行容器时创建的所有东西。选择一个有足够空间的位置,因为所使用的磁盘空间会随着时间的推移而增长。如果您编辑了/etc/default/docker,您将需要重新启动docker守护进程以使更改生效。
现在您应该能够创建一个新的映像(或从Docker Hub中提取一个映像),并且您应该会看到在您使用-g选项指定的目录中创建了一堆文件。
我在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
你的cgroups已经启用了cpuset控制器。这个控制器在NUMA环境中非常有用,它允许精细地指定允许运行哪个CPU/内存库的任务。
默认情况下是强制的cpuset。Mems和cpuset。cpu没有设置,这意味着“没有空间留给”您的任务,因此出现错误。
解决这个问题最简单的方法是启用cgroup。将根组中的Clone_children改为1。对你来说,应该是
echo 1 > /sys/fs/cgroup/docker/cgroup.clone_children
它基本上会指示系统自动初始化容器的cpuset。Mems和cpuset。来自父cgroup的cpu。