docker / docker/docs

dockerd-rootless-setuptool.sh install fails to detect systemd unless $XDG_RUNTIME_DIR is set first

Open Beginner friendly
#14,491 13 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/install area/security lifecycle/frozen
Dominant language
Markdown
Stars
4.7k
Forks
8.5k
Avg merge
2d 18h
Merged PRs (30d)
108

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rootless installation page at docs.docker.com/engine/security/rootless/#install and review the instructions around dockerd-rootless-setuptool.sh install. Update the documentation to explain setting XDG_RUNTIME_DIR before running the command, including the relevant troubleshooting guidance, and confirm the systemd-not-detected case is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux, shell
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.