Description
Problem description
When I follow the rootless installation instructions on Linux Mint 20 (based on Ubuntu 20.04) it fails to detect systemd:
dockerd@emvc:~$ dockerd-rootless-setuptool.sh install
[INFO] systemd not detected, dockerd-rootless.sh needs to be started manually:
PATH=/usr/bin:/sbin:/usr/sbin:$PATH dockerd-rootless.sh
[INFO] Creating CLI context "rootless"
Successfully created context "rootless"
[INFO] Make sure the following environment variables are set (or add them to ~/.bashrc):
# WARNING: systemd not found. You have to remove XDG_RUNTIME_DIR manually on every logout.
export XDG_RUNTIME_DIR=/home/dockerd/.docker/run
export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///home/dockerd/.docker/run/docker.sock
Setting XDG_RUNTIME_DIR as the script suggests does not help. systemctl --user
still fails with "Failed to connect to bus: No such file or directory". Following this StackOverflow answer, what works is setting XDG_RUNTIME_DIR to /run/user/... before running dockerd-rootless-setuptool.sh install
:
export XDG_RUNTIME_DIR=/run/user/$(id -u)
dockerd-rootless-setuptool.sh install
(I actually added it to .bash_profile - that would be helpful to add, too. Unlike .bashrc, .bash_profile gets loaded when using sudo -iu dockerd
)
(I also enabled lingering for the user first, following that answer, but I don't know if that was strictly necessary.)
Problem location
https://docs.docker.com/engine/security/rootless/#install
Suggestions for a fix
I'm not sure if this is a problem with the documentation or the dockerd-rootless-setuptool.sh script itself could handle this better, but assuming the script is not changed, it would help if the documentation page suggested setting XDG_RUNTIME_DIR before running the script, or at least in the troubleshooting section if you get
[INFO] systemd not detected, dockerd-rootless.sh needs to be started manually