操作系统:Ubuntu 22.04
Docker:25.0.1
我正在按照说明设置无根dockerhttps://docs.docker.com/engine/security/rootless/但我收到以下错误:
$ dockerd-rootless-setuptool.sh install
[INFO] Creating /home/pc/.config/systemd/user/docker.service
[INFO] starting systemd service docker.service
+ systemctl --user start docker.service
+ sleep 3
+ systemctl --user --no-pager --full status docker.service
● docker.service - Docker Application Container Engine (Rootless)
Loaded: loaded (/home/pc/.config/systemd/user/docker.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2024-01-27 17:33:44 EST; 758ms ago
Docs: https://docs.docker.com/go/rootless/
Process: 145135 ExecStart=/usr/bin/dockerd-rootless.sh (code=exited, status=1/FAILURE)
Main PID: 145135 (code=exited, status=1/FAILURE)
CPU: 6ms
Jan 27 17:33:44 dev dockerd-rootless.sh[145135]: + [ -z ]
Jan 27 17:33:44 dev dockerd-rootless.sh[145135]: + command -v vpnkit
Jan 27 17:33:44 dev dockerd-rootless.sh[145135]: + echo Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed
Jan 27 17:33:44 dev dockerd-rootless.sh[145135]: Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed
Jan 27 17:33:44 dev dockerd-rootless.sh[145135]: + exit 1
Jan 27 17:33:44 dev systemd[2053]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jan 27 17:33:44 dev systemd[2053]: docker.service: Failed with result 'exit-code'.
+ set +x
[ERROR] Failed to start docker.service. Run `journalctl -n 20 --no-pager --user --unit docker.service` to show the error log.
[ERROR] Before retrying installation, you might need to uninstall the current setup: `/usr/bin/dockerd-rootless-setuptool.sh uninstall -f ; /usr/bin/rootlesskit rm -rf /home/pc/.local/share/docker`
错误日志:
$ journalctl -n 20 --no-pager --user --unit docker.service
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + :
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + : builtin
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + : auto
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + : auto
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + net=
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + mtu=
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + [ -z ]
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + command -v slirp4netns
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + [ -z ]
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + command -v vpnkit
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + echo Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: Either slirp4netns (>= v0.4.0) or vpnkit needs to be installed
Jan 27 17:33:46 dev dockerd-rootless.sh[145142]: + exit 1
Jan 27 17:33:46 dev systemd[2053]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jan 27 17:33:46 dev systemd[2053]: docker.service: Failed with result 'exit-code'.
Jan 27 17:33:49 dev systemd[2053]: docker.service: Scheduled restart job, restart counter is at 3.
Jan 27 17:33:49 dev systemd[2053]: Stopped Docker Application Container Engine (Rootless).
Jan 27 17:33:49 dev systemd[2053]: docker.service: Start request repeated too quickly.
Jan 27 17:33:49 dev systemd[2053]: docker.service: Failed with result 'exit-code'.
Jan 27 17:33:49 dev systemd[2053]: Failed to start Docker Application Container Engine (Rootless).
日志未提供任何有用信息。我该怎么做才能让它正常工作?
答案1
根据日志和这个问题(https://github.com/moby/moby/issues/41781),使用“apt install slirp4netns”安装缺少的依赖项即可。它应该包含在docker-ce-rootless-extras中,但您也可以自己动手。