我是按以下方式操作的:
1、查看操作系统版本
hostnamectl,查看到信息:
Operating System: UnionTech OS Desktop 20 Pro
Kernel: Linux 4.19.71-arm64-desktop
Architecture: arm64
2、查看UOS底层debian版本:
cat /etc/debian_version看到 基于debian 10.5
debian 10.x版本 ,代号为:buster (相关开源软件下载时,如果有对应系统和版本,可以选 debian buster 最为接近)
3、编辑 /etc/apt/source.list,添加docker的apt源
添加下面一行:
deb [arch=arm64] https://download.docker.com/linux/debian buster stable
4、添加docker官方证书 (解决此问题:apt update 会失败----由于没有公钥,无法验证docker相关的签名)
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
5、更新apt源,然后安装docker
apt update
apt install docker-ce docker-ce-cli containerd.io
6、检查下 docker版本:
docker version命令提示错误:“Cannot connect to the Docker daemon”
7、执行systemctl restart docker报错:
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”,似乎没有什么有价值的错误。
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-10-28 15:12:26 CST; 42s ago
Docs: https://docs.docker.com
Process: 14988 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 14988 (code=exited, status=1/FAILURE)
10月 28 15:12:26 uos-ZJ0063 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
10月 28 15:12:26 uos-ZJ0063 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
10月 28 15:12:26 uos-ZJ0063 systemd[1]: Stopped Docker Application Container Engine.
10月 28 15:12:26 uos-ZJ0063 systemd[1]: docker.service: Start request repeated too quickly.
10月 28 15:12:26 uos-ZJ0063 systemd[1]: docker.service: Failed with result 'exit-code'.
10月 28 15:12:26 uos-ZJ0063 systemd[1]: Failed to start Docker Application Container Engine.
继续执行:“journalctl -xe”
发现有错误:
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: time="2023-10-28T14:53:06.784647548+08:00" level=warning msg="Running modprobe bridge br_netfilter failed with message: modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.71-arm64-desktop/modules.dep.bin'\nmodprobe: WARNING: Module bridge not found in directory /lib/modules/4.19.71-arm64-desktop\nmodprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.71-arm64-desktop/modules.dep.bin'\nmodprobe: WARNING: Module br_netfilter not found in directory /lib/modules/4.19.71-arm64-desktop\n, error: exit status 1"
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: time="2023-10-28T14:53:06.826205844+08: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 a preferred IP address"
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: time="2023-10-28T14:53:06.842479493+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: time="2023-10-28T14:53:06.842976863+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: failed to start daemon: Error initializing network controller: error creating default "bridge" network: Failed to program NAT chain: Failed to inject DOCKER in PREROUTING chain: iptables failed: iptables --wait -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER: iptables v1.8.2 (legacy): Couldn't load match `addrtype':No such file or directory
10月 28 14:53:06 uos-ZJ0063 dockerd[10548]: Try `iptables -h' or 'iptables --help' for more information.
网上查了一下,说是安装 “apt install bridge-utils”
但执行完,重启docker,还是一样的错误。
有热心的思友知道是什么问题吗?多谢解答!
重新开一个干净的系统,然后
再然后试试
排除变量法,看看是通信本身安装 docker 就有问题,还是你的现有的系统状态导致的