docker ps 卡住了...docker install 也挂了

docker ps 卡住了...docker install 也挂了

docker ps第一个症状是永远挂起,所以我清除了docker并尝试重新安装...但安装从未完成

dpkg -l|grep docker
iF  docker-ce                                  5:19.03.8~3-0~ubuntu-bionic                amd64        Docker: the open-source application container engine
ii  docker-ce-cli                              5:19.03.8~3-0~ubuntu-bionic                amd64        Docker CLI: the open-source application container engine

注意上面的docker安装失败,如下所示iF...详细信息请参见dpkg -l | head -3

在 Ubuntu 20.04 上,docker 无法完成安装

sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aufs-tools cgroupfs-mount containerd.io docker-ce-cli pigz
The following NEW packages will be installed:
  aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli pigz
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/85.7 MB of archives.
After this operation, 385 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Selecting previously unselected package pigz.
(Reading database ... 272586 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting previously unselected package aufs-tools.
Preparing to unpack .../1-aufs-tools_1%3a4.14+20190211-1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:4.14+20190211-1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../2-cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../3-containerd.io_1.2.13-1_amd64.deb ...
Unpacking containerd.io (1.2.13-1) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../4-docker-ce-cli_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../5-docker-ce_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce (5:19.03.8~3-0~ubuntu-bionic) ...
Setting up aufs-tools (1:4.14+20190211-1ubuntu1) ...
Setting up containerd.io (1.2.13-1) ...
Setting up docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) ...
Setting up pigz (2.4-1) ...
Setting up cgroupfs-mount (1.4) ...
Setting up docker-ce (5:19.03.8~3-0~ubuntu-bionic) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.

之前的安装都正常,直到我注意到 docker ps它一直挂着……我清除了docker,包括删除了所有的

apt-get purge docker-*  -y
rm -rf /var/lib/docker
systemctl daemon-reload

这是我的恰当入口

cd  /etc/apt ; grep -r docker 

sources.list.d/docker.list:deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

然后我运行上面的安装,但它也一直挂起,所以无奈之下我在下面添加了删除命令列表...没有帮助

rm /var/run/docker.pid
rm -rf /lib/systemd/system/docker.service
rm -rf /etc/docker
rm -rf /run/docker.sock
rm -rf /etc/systemd/system/docker.service.d

docker version即使以 root 身份也挂起

uname -m && uname -r && cat /etc/*release
x86_64
5.4.0-30-generic
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"

我即将重新格式化我的笔记本电脑并从头开始重新安装 Ubuntu 20.04...有什么建议吗?

显然,docker-ce 清除软件包逻辑留下了神秘的 docker 残留,从而阻止了后续 docker 安装的正常工作

PS...我的远程 VPS ubuntu 18.04 都可以很好地运行 docker,所以不知道这是否与 Ubuntu 20.04 有关,尽管我看到 docker 在其他 20.04 盒子上运行正常

更新

是的,当我从 5.4.0-30-generic 恢复到内核 29 时,docker 工作正常,当我再次返回内核 30 时,它以同样的方式失败了...这是内核 5.4.0-30-generic

sudo journalctl -u docker

May 06 15:42:10 kiev systemd[1]: Starting Docker Application Container Engine...
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.613610505-04:00" level=info msg="Starting up"
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.615578768-04:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.>
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.645651302-04:00" level=info msg="parsed scheme: \"unix\"" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.645870506-04:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.645925462-04:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=>
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.645942687-04:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.648421919-04:00" level=info msg="parsed scheme: \"unix\"" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.648915679-04:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.649020592-04:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}" module=>
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.649038754-04:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.845831131-04:00" level=warning msg="Your kernel does not support swap memory limit"
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.845857901-04:00" level=warning msg="Your kernel does not support cgroup blkio weight"
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.845868145-04:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.846071798-04:00" level=info msg="Loading containers: start."
May 06 15:42:10 kiev dockerd[6798]: time="2020-05-06T15:42:10.955282685-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set>
May 06 15:42:11 kiev dockerd[6798]: time="2020-05-06T15:42:11.027647745-04:00" level=info msg="Loading containers: done."

因此问题仅在使用内核 5.4.0-30-generic 时发生,而 5.4.0-29-generic 则正常

docker-ce    5:19.03.8~3-0~ubuntu-bionic      amd64  

更新

docker 在 Ubuntu 20.04 上正常运行,其当前内核为 5.8.0-32-generic

答案1

我也一样。最新内核出了问题。恢复到 5.4.0.28 可以解决问题

答案2

我的解决方法有点不同,对我有用的解决方案是我在恢复模式下进入内核,然后我设法完全卸载docker,因为docker没有卡在那里。我想无论你有什么内核,你都可以做同样的事情,但说实话我降级到5.4.0-29就像上面的答案一样。尽管如此,上一个答案的问题是,当我尝试启动内核时5.4.0-29containerd启动时卡住,而其他版本卡住发生在您尝试执行某些 docker 命令时,所以让我更详细地解释一下我所做的步骤

您需要编辑sudo nano /etc/default/grub文件,删除行首的“#”符号

  1. GRUB_TIMEOUT=20显示菜单 20 秒
  2. GRUB_TIMEOUT_STYLE=menu显示启动菜单

然后保存文件并退出编辑器。接下来运行:

sudo update-grub 
sudo reboot

[进入启动菜单1

进入恢复模式

选择根终端并按 ok 和回车键

之后,您就可以完全卸载 Docker 运行:

sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce 

上述命令不会删除主机上的镜像、容器、卷或用户创建的配置文件。如果您希望删除所有镜像、容器和卷,请运行以下命令:

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock

您已从系统中完全删除 Docker没有任何docker卡住

答案3

切换到 5.4.0-29 即可解决问题

sudo apt-get update
sudo apt-get -y install linux-image-extra-virtual

代替GRUB_DEFAULT=0GRUB_DEFAULT="$entry1>$entry2"

sudo nano /etc/default/grub

这是通过运行以下命令将第一个子菜单条目 ($entry1) 和具有 .29 内核版本(或任何其他首选版本)(不是恢复版本)的条目 ($entry2) 连接起来的结果,中间带有“>” grep -A100 submenu /boot/grub/grub.cfg |grep menuentry

然后更新 grub 并重启

sudo update-grub
sudo reboot

最后重新安装docker。一切都应该很好。

来源:https://meetrix.io/blog/aws/changing-default-ubuntu-kernel.html

更新20/5

Ubuntu 发布5.4.0-31-通用在里面建议的可以很好地与 docker 配合使用的通道。因此,无论谁使用了这个技巧,都可以切换回GRUB_DEFAULT=0再次出发应该会很好。

答案4

docker 在 Ubuntu 20.04 上正常运行

uname -a
Linux milan 5.4.0-31-generic #35-Ubuntu SMP Thu May 7 20:20:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


grep -r docker /etc/apt
# /etc/apt/sources.list.d/docker.list:# deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic test
/etc/apt/sources.list.d/docker.list:deb [arch=amd64] https://download.docker.com/linux/ubuntu focal test




docker version
Client: Docker Engine - Community
 Version:           19.03.9
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        9d988398e7
 Built:             Fri May 15 00:25:20 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.9
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       9d988398e7
  Built:            Fri May 15 00:23:53 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

https://github.com/docker/for-linux/issues/993

相关内容