docker 容器Driver devicemapper failed to remove root filesystem

1. 当部署完一个私有仓库后,同台机器运行正常,但是跨机器访问不行,提示如下错误:
$ docker pull myip:5000/mybusybox
Using default tag: latest
Error response from daemon: Get https://myip:5000/v2/: http: server gave HTTP response to HTTPS client
解决方案:Create or modify /etc/docker/daemon.json on the client machine,adding the following line:
{ "insecure-registries":["myip:5000"] }
[汗,由于忘记输入最后一个字符“}”,导致启动不起来docker,总是报以下错误:
# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
# journalctl -xe
Sep 07 16:56:13 192.168.177.131 systemd[1]: docker.service: main process exited,
Sep 07 16:56:13 192.168.177.131 systemd[1]: Failed to start Docker Application C
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit docker.service has failed.
-- The result is failed.
 这种错误太可怕了,尤其是不熟悉运行机制的情况下。
]
然后重启docker就可以了:
systemctl restart docker

2. 在调用命令“curl -i -X DELETE http://192.168.13.102:5000/v2/myhello/manifests/"进行软删除镜像的过程中出现如下错误:{"errors":[{"code":"UNSUPPORTED","message":"The operation is unsupported."}]}
解决方案:在启动registry时指定以下环境变量:-e REGISTRY_STORAGE_DELETE_ENABLED=true

3. 当用垃圾回收私有镜像库后,再调用api去发布镜像,虽提示成功,并且用api查看相关信息也是正确的,但实际上却无法拉取镜像,直接查看镜像库会发现对应的blobs根本就没有生成。
解决方案:重启一下私有镜像库就可以了。

4. 当把一个java程序连同依赖包放进容器运行之后,提示:.../java xxx: Permission Denied。
解决方案:chmod +x .../java,即改为可执行就可以了,linux基础太弱了,一个小问题都可以栽个大跟头,慢慢学吧。

5. 当删除一个dead容器时碰到如下错误(docker 17.06.1-ce on CentOS 7):
docker rm 60f6b
Error response from daemon: driver "overlay" failed to remove root filesystem for 60f6bfc7eede89720e7127567e12113b652d0de43047fc69e0df07ce6c5f8d65: remove /var/lib/docker/overlay/fc5f1f67576dec08f16d710aa06235541f81d0d3c7a127c43967869d17143381/merged: device or resource busy
解决方案1:
1. Check which other  processes are also using docker resources
$ grep fc5f1f67576dec08f16d710aa06235541f81d0d3c7a127c43967869d17143381  /proc/*/mountinfo
/proc/3008/mountinfo:319 317 0:40 / /var/lib/docker/overlay/fc5f1f67576dec08f16d710aa06235541f81d0d3c7a127c43967869d17143381/merged rw,relatime shared:235 - overlay overlay rw,seclabel,lowerdir=/var/lib/docker/overlay/e6c574755784de58d2050b54aecee7d5028b5459bec0e826cf1723ddccaec016/root,upperdir=/var/lib/docker/overlay/fc5f1f67576dec08f16d710aa06235541f81d0d3c7a127c43967869d17143381/upper,workdir=/var/lib/docker/overlay/fc5f1f67576dec08f16d710aa06235541f81d0d3c7a127c43967869d17143381/work
which outputs something like above, where the number after /proc/ is the pid.
2. Check the process name of the above pid
$ ps -p 3008 -o comm=
colord
This is suspicious!!!
3. restart colord and then I can remove the container successfully.
$ systemctl restart colord
$ docker rm 60f6b
60f6b
解决方案2(未测试):
If you ge message like this:
Error response from daemon: Cannot destroy container elated_wozniak: Driver devicemapper failed to remove root filesystem 656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3: Device is Busy
Just run the following command:
umount /var/lib/docker/devicemapper/mnt/656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3

Try running the following commands. It always works for me.
# docker volume rm $(docker volume ls -qf dangling=true)
# docker rm $(docker ps -q -f 'status=exited')
After execution of the above commands, restart docker by,
# service docker restart
6. 有一同事遇到如下问题:
"HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /v2/_catalog (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))"
解决方案:把“127.0.0.1”改为具体ip地址;另一处修改是把同事的所有iptables的修改都删除了,好像原有的内容影响了docker的网络解析,自己懒,没有深究什么原因。

猜你喜欢

转载自blog.csdn.net/shengerjianku/article/details/80410679