Docker:无法启动Docker守护进程,无法终止容器



所以我遇到了这个问题,Docker决定在我的Ubuntu 20.04虚拟机上托管,该虚拟机托管在VirtualBox上。

当我第一次启动我的虚拟机时,没有任何docker命令可以工作。即使是像docker helpdocker version这样的基本命令也会无限期挂起,与docker交互的系统命令也是如此(例如,sudo service docker [options]将挂起(。

我尝试了sudo dockerd --debug,通过它我发现var/run/docker.pid文件就是问题所在:

root@david-VirtualBox:~$ dockerd --debug 
INFO[2020-11-16T13:01:11.177637329Z] Starting up                                  
failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid

我删除了docker.pid文件,然后再次尝试该命令。这一次,我得到了一个不同的输出,报告它无法启动守护进程:

root@david-VirtualBox:/# dockerd --debug
INFO[2020-11-16T13:09:41.943314961Z] Starting up                                  
DEBU[2020-11-16T13:09:41.944098502Z] Listener created for HTTP on unix (/var/run/docker.sock) 
INFO[2020-11-16T13:09:41.944468539Z] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf 
DEBU[2020-11-16T13:09:41.944911830Z] Golang's threads limit set to 71280          
INFO[2020-11-16T13:09:41.945385664Z] parsed scheme: "unix"                         module=grpc
INFO[2020-11-16T13:09:41.945410177Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-11-16T13:09:41.945442019Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2020-11-16T13:09:41.945481992Z] ClientConn switching balancer to "pick_first"  module=grpc
DEBU[2020-11-16T13:09:41.945451065Z] metrics API listening on /var/run/docker/metrics.sock 
INFO[2020-11-16T13:09:41.949860396Z] parsed scheme: "unix"                         module=grpc
INFO[2020-11-16T13:09:41.950283701Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-11-16T13:09:41.950370138Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2020-11-16T13:09:41.950401555Z] ClientConn switching balancer to "pick_first"  module=grpc
DEBU[2020-11-16T13:09:41.952229031Z] Using default logging driver json-file       
DEBU[2020-11-16T13:09:41.952481958Z] [graphdriver] priority list: [btrfs zfs overlay2 fuse-overlayfs aufs overlay devicemapper vfs] 
DEBU[2020-11-16T13:09:41.972318409Z] processing event stream                       module=libcontainerd namespace=plugins.moby
DEBU[2020-11-16T13:09:41.990153845Z] backingFs=extfs, projectQuotaSupported=false, indexOff="index=off,"  storage-driver=overlay2
INFO[2020-11-16T13:09:41.990191679Z] [graphdriver] using prior storage driver: overlay2 
DEBU[2020-11-16T13:09:41.990211633Z] Initialized graph driver overlay2            
DEBU[2020-11-16T13:09:42.232203720Z] No quota support for local volumes in /var/lib/docker/volumes: Filesystem does not support, or has not enabled quotas 
DEBU[2020-11-16T13:09:43.228522173Z] Cleaning up old mountid : start.             
failed to start daemon: error while opening volume store metadata database: timeout

从这里开始,docker命令开始半工作——例如,docker version将返回预期的版本信息,但将以Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?结束。

在这个阶段,我用service --status-all检查了进程,这表明服务已停止([ - ] docker(。我向service docker status核实了详细信息。这表明有一个容器没有正确退出,这扰乱了服务:

root@david-VirtualBox:/# service docker status
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (start) since Mon 2020-11-16 12:59:30 GMT; 32min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 2299 (dockerd)
Tasks: 30
Memory: 155.7M
CGroup: /system.slice/docker.service
└─2299 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Nov 16 12:59:31 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:31.277141877Z" level=info msg="scheme "unix" not registered, fallback to default scheme" module=grpc
Nov 16 12:59:31 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:31.277175560Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil>>
Nov 16 12:59:31 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:31.277504809Z" level=info msg="ClientConn switching balancer to "pick_first"" module=grpc
Nov 16 12:59:32 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:32.086919338Z" level=info msg="[graphdriver] using prior storage driver: overlay2"
Nov 16 12:59:34 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:34.809584302Z" level=warning msg="Your kernel does not support swap memory limit"
Nov 16 12:59:34 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:34.809620318Z" level=warning msg="Your kernel does not support CPU realtime scheduler"
Nov 16 12:59:34 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:34.809667654Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Nov 16 12:59:34 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:34.809685962Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Nov 16 12:59:34 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:34.809995542Z" level=info msg="Loading containers: start."
Nov 16 12:59:45 david-VirtualBox dockerd[2299]: time="2020-11-16T12:59:45.004470995Z" level=info msg="Container bcbf2dcf0dea989cee6a5f92cc9fcf8d29f4e29b7cf0fc8e119a0e17f3a29235 failed to exit>
lines 1-21/21 (END)

问题就在这里——我不能启动docker来杀死那个容器。该命令需要Docker守护进程运行,但我尝试重新启动服务的所有命令都会无限期挂起。servicesystemctl都不起作用。

如有任何帮助,我们将不胜感激!

编辑:执行这些步骤后,ps -eax | grep docker会产生以下输出:

root@david-VirtualBox:/# ps -eax | grep docker
3787 ?        Ssl    0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock LANG=en_GB.UTF-8 LANGUAGE=en_GB:en PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin NOTIFY_SOCKET=/run/systemd/notify LISTEN_PID=3787 LISTEN_FDS=1 LISTEN_FDNAMES=docker.socket INVOCATION_ID=cf888947b40240069005c1553c951633 JOURNAL_STREAM=9:49757
3843 pts/0    S+     0:00 grep --color=auto docker SHELL=/bin/bash COLORTERM=truecolor SUDO_GID=1000 LANGUAGE=en_GB:en SUDO_COMMAND=/usr/bin/su SUDO_USER=david PWD=/ LOGNAME=root XAUTHORITY=/run/user/1000/gdm/Xauthority HOME=/root LANG=en_GB.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LESSCLOSE=/usr/bin/lesspipe %s %s TERM=xterm-256color LESSOPEN=| /usr/bin/lesspipe %s USER=root DISPLAY=:0 SHLVL=0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin SUDO_UID=1000 MAIL=/var/mail/root OLDPWD=/run _=/usr/bin/grep

当我试图用sudo kill <pid>sudo kill -9 <pid>杀死这些进程时,它们会用不同的PID不断复活。这些会是僵尸程序吗?

Docker容器存储在Linux上/var/lib/docker/的默认位置。如果您可以识别容器并删除它,然后尝试启动docker。如果成功并且可以成功运行docker ps -a命令,则可以开始删除此容器的跟踪。

注意:在尝试此操作之前,我会先快照您的虚拟机。

相关内容

  • 没有找到相关文章

最新更新