ubuntu中查看docker ps发现内容为空,但是容器在运行
查看docker ps
- root@hello:~# docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
查看docker info
结果发现
Docker Root Dir: /var/snap/docker/common/var-lib-docker
注意,这里是snap版的docker,常见的问题是apt版和docker版同时安装了,
查看sanp软件列表
- hello@hello:/root$ snap list
- Name Version Rev Tracking Publisher Notes
- core18 20220706 2538 latest/stable canonical✓ base
- docker 20.10.14 1779 latest/stable canonical✓ -
- snapd 2.56.2 16292 latest/stable canonical✓ snapd
可以看到有一个sanp版的docker
查看apt列表
- hello@hello:/root$ apt list --installed | grep 'docker'
-
- WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
-
- docker-ce/bionic,now 5:20.10.16~3-0~ubuntu-bionic amd64 [installed,upgradable to: 5:20.10.17~3-0~ubuntu-bionic]
- docker-ce-cli/bionic,now 5:20.10.16~3-0~ubuntu-bionic amd64 [installed,upgradable to: 5:20.10.17~3-0~ubuntu-bionic]
- docker-ce-rootless-extras/bionic,now 5:20.10.16~3-0~ubuntu-bionic amd64 [installed,upgradable to: 5:20.10.17~3-0~ubuntu-bionic]
- docker-compose-plugin/bionic,now 2.5.0~ubuntu-bionic amd64 [installed,upgradable to: 2.6.0~ubuntu-bionic]
- docker-scan-plugin/bionic,now 0.17.0~ubuntu-bionic amd64 [installed]
可以看到也有一个apt版的docker
两个版本的docker安装上肯定有冲突,所以解决方案就是卸载掉snap版的docker后重启
- #卸载snap版docker
- sudo snap remove docker
- #重启
- reboot