我有安装了Docker的CentOS 7.2 VM。 Docker服务和Docker容器之前正常工作。但是当我试图拉出一个docker镜像时,VM突然关闭了。重新启动VM后,无法启动Docker服务:
[root@AY13091717064020986bZ ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
systemctl status docker.service
输出:
[root@AY13091717064020986bZ ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2016-08-23 19:11:19 CST; 13min ago
Docs: http://docs.docker.com
Process: 1404 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
Main PID: 1404 (code=exited, status=1/FAILURE)
Aug 23 19:11:17 AY13091717064020986bZ systemd[1]: Starting Docker Application Container Engine...
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.448828158+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly discou...v section."
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" faile...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: de...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
" journalctl -xe
"输出:
[root@AY13091717064020986bZ ~]# journalctl -xe
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: btree spine: node_check failed: csum 1600702373 != wanted 1600827965
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: Buffer I/O error on device dm-1, logical block 2621424
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper:
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
-- 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.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Aug 23 19:11:19 AY13091717064020986bZ polkitd[1014]: Unregistered Authentication Agent for unix-process:1370:16052 (system bus name :1.22, object path /org/freedesktop/PolicyKit1/Authenticati
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.
Docker版本:
[root@AY13091717064020986bZ ~]# docker version
Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
Go version: go1.6.3
Git commit: d381c64-unsupported
Built: Thu Aug 4 13:21:17 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Linux内核版本:
[root@AY13091717064020986bZ ~]# uname -a
Linux AY13091717064020986bZ 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@AY13091717064020986bZ ~]#
CentOS版本:
[root@AY13091717064020986bZ ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
[root@AY13091717064020986bZ ~]#
答案 0 :(得分:8)
我有类似的问题。这是我永久修复它的方式:
删除rm -rf /var/lib/docker
中的所有内容。这将删除现有的容器和图像:
{
"graph": "/mnt/docker-data",
"storage-driver": "overlay"
}
然后配置您的守护程序以使用" overlay"存储驱动程序在位于" / etc / docker /"中的daemon.json文件中设置以下标志。如果文件不存在,只需创建它,然后添加以下内容:
{{1}}
现在再次正常启动Docker,所有这些都应该正常工作。
答案 1 :(得分:4)
我遇到了类似的问题。重新启动后一切顺利。
sudo shutdown -r now
然后检查
systemctl status docker
答案 2 :(得分:2)
只有此命令帮助我了解此错误的原因:
dockerd
在输出中,我看到:运行docker不支持您的Linux内核版本2.6.32-042stab127.2。请将您的内核升级到3.10.0或更高版本。
答案 3 :(得分:1)
您只需要删除container文件夹并重新启动
sudo rm /var/lib/docker/containers/ -rf && sudo reboot
答案 4 :(得分:1)
通过删除/ etc / docker,您将丢失所有图像和数据。
您可以使用以下方式查看日志
journalctl -u docker.services
重新启动服务器
sudo重新启动
systemctl守护程序重新加载&& systemctl启用docker && systemctl启动docker
这对我有用。
答案 5 :(得分:1)
我遇到了类似的问题。这就是我永久修复它的方式:
mv etc/docker/daemon.json daemon.conf
systemctl daemon-reload
service docker restart
答案 6 :(得分:1)
在我的情况下,它是空的 daemon.json
文件,删除此文件修复了它:
sudo rm -rf /etc/docker/daemon.json
sudo systemctl start docker
答案 7 :(得分:0)
我遇到了类似的问题,这似乎是由于先前安装中/var/lib/docker
遗留下来造成的。
背景细节:我简单地使用了CentOS extras存储库中的Docker;然后我删除了它,安装了Docker存储库,并从该存储库安装了docker-ce。这使/var/lib/docker
落后并填充,但不归docker-ce包所有。
以下修正了此问题:
rpm -e docker-ce
rm -f /var/lib/docker
yum install docker-ce
答案 8 :(得分:0)
我刚刚删除了/ var / lib / docker下的所有文件夹并重新启动了服务器,从而修复了rhel 7.7系统中的相同问题
发生这种情况是因为我想创建一个文件系统,该文件系统要挂载在分配了映像的/ var / lib / docker上。
********请注意,如果您想保留任何图像,只需执行docker save命令即可
答案 9 :(得分:0)
步骤1。使用“ dockerd”命令检查确切原因
[root@c7 docker]# dockerd
INFO[2020-06-03T11:27:50.293740882+05:30] Starting up
INFO[2020-06-03T11:27:50.298500541+05:30] parsed scheme: "unix" module=grpc
INFO[2020-06-03T11:27:50.298535150+05:30] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-06-03T11:27:50.298568308+05:30] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-06-03T11:27:50.298582671+05:30] ClientConn switching balancer to "pick_first" module=grpc
INFO[2020-06-03T11:27:50.305144487+05:30] parsed scheme: "unix" module=grpc
INFO[2020-06-03T11:27:50.305193838+05:30] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2020-06-03T11:27:50.305239948+05:30] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 <nil>}] <nil>} module=grpc
INFO[2020-06-03T11:27:50.305254274+05:30] ClientConn switching balancer to "pick_first" module=grpc
failed to start daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay2, devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)
第2步:删除overlay
或devicemapper
存储。应该只有1个存储空间
[root@c7 docker]# rm -rf devicemapper
Step3:现在启动docker [root @ c7 docker]#systemctl启动docker
第四步:如果您遇到以下错误
[root@c7 docker]# docker container ls
无法通过unix:///var/run/docker.sock
连接到Docker守护程序。泊坞窗守护程序正在运行吗?
第5步:删除以下文件,然后重新启动docker
[root@c7 docker]# rm -rf /var/run/docker.pid
[root@c7 docker]# systemctl restart docker
第6步:您将取回图像并运行容器
答案 10 :(得分:0)
dockerd 拯救了我的一天,它显示 iptables/firewalld 丢失。 安装相同,它就像魅力一样。
答案 11 :(得分:0)
我使用的是 docker desktop,其中在设置中我删除了 WSL_update_x64 中的所有内容。之前没有安装过。所以在安装后我从设置中删除了文件并重新启动。