我正在尝试将daemon安装为非root用户,遵循以下指南:https://docs.docker.com/engine/security/rootless/
首先,我删除了现有的rootful守护进程。
然后我创建了一个名为docker-user的用户,并使它成为docker组的成员。
然后,我切换到了这个码头用户的shell,如下所示:
sudo -iu docker-user并运行上述链接中给出的无根码头安装脚本。
脚本输出:
docker-user@ubuntu:~$ curl -fsSL https://get.docker.com/rootless | sh
# Installing stable version 19.03.8
# Existing rootless Docker detected at /home/docker-user/bin/dockerd
# systemd not detected, dockerd daemon needs to be started manually
/home/docker-user/bin/dockerd-rootless.sh --experimental --storage-driver vfs
# Docker binaries are installed in /home/docker-user/bin
# Make sure the following environment variables are set (or add them to ~/.bashrc):
export DOCKER_HOST=unix:///tmp/docker-1003/docker.sock查看脚本,如果是systemd not detected, dockerd daemon needs to be started manually,则输出行systemctl --user daemon-reload
systemctl --user daemon-reload的输出是
docker-user@ubuntu:~$ systemctl --user daemon-reload
Failed to connect to bus: No such file or directory我不想手动启动码头,它应该像通常的码头安装一样作为服务运行。根据指南,我应该可以把它作为一种服务来运行。我做错了什么?
发布于 2021-07-09 20:31:18
您要么需要使用pam_systemd登录,要么为用户启用挥之不去的功能,然后就可以对systemctl --user进行故障排除。
pam_systemd (来源)登录
尝试下列方法之一:
ssh @localhostmachinectl shell @登录后,您应该看到您使用loginctl list-sessions进行的会话。如果这样做,请继续进行“疑难解答systemctl --user”。
否则,如果上述任何一种方法都不起作用,请试着让用户继续使用,如下文所述。
loginctl)检查用户是否已经在逗留。
ls /var/lib/systemd/linger (来源)
如果您在这里看到您的用户,请继续“疑难解答systemctl --user”。
否则,启用用户在loginctl enable-linger 中徘徊。请注意,您可以省略参数以使用当前用户。
然后,您应该看到您的用户使用ls /var/lib/systemd/linger。
systemctl --user的故障诊断
现在您已经知道您的用户是使用pam_systemd活动的,或者是挥之不去的,您可以尝试连接到systemd:
运行systemctl --user
如果该命令运行时没有错误,那么systemd应该已经准备好安装无根停靠程序了。
如果打印Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=@.host --user to connect to bus of other user),则将$XDG_RUNTIME_DIR设置为适当的值(通常为export XDG_RUNTIME_DIR=/run/user/$UID)
然后运行systemctl --user
如果该命令运行时没有错误,那么systemd应该已经准备好安装无根停靠程序了。
如果这样打印Failed to connect to bus: No such file or directory,那么您可能没有使用pam_systemd登录,或者不允许用户逗留。
https://unix.stackexchange.com/questions/587674
复制相似问题