docker / docker-install

Docker installation script
https://get.docker.com
Apache License 2.0
2.43k stars 780 forks source link

[Docker Rootless] systemd not detected (docker-ce-rootless-extras) #326

Open iocron opened 1 year ago

iocron commented 1 year ago

OS: Ubuntu 22.04.1 LTS Installed packages (apt-get): uidmap and docker-ce-rootless-extras Running Command: dockerd-rootless-setuptool.sh install Results in:

[INFO] systemd not detected, dockerd-rootless.sh needs to be started manually:

PATH=/home/valheim/bin:/sbin:/usr/sbin:$PATH dockerd-rootless.sh

[INFO] CLI context "rootless" already exists
[INFO] Use CLI context "rootless"
Current context is now "rootless"

[INFO] Make sure the following environment variables are set (or add them to ~/.bashrc):

export PATH=/home/valheim/bin:$PATH
Some applications may require the following environment variable too:
export DOCKER_HOST=unix:///home/valheim/.docker/run/docker.sock

I've tested nearly all variations to work around it. E.g. setting export variables beforehand, setting them on runtime, giving the user all kinds of permissions, using loginctl enable-linger, etc. But none seems to work. The only way I was beeing able to make it work was the following:

XDG_RUNTIME_DIR=/home/valheim/.docker/run curl -fsSL https://get.docker.com/rootless | s
AkihiroSuda commented 1 year ago

Explained in https://rootlesscontaine.rs/getting-started/common/login/

The $XDG_RUNTIME_DIR environmental variable is set when:

  • Logged in as a non-root user via the graphic console .
  • Logged in as a non-root user via ssh <user>@<hostname> .
  • Logged in as the root, and then switched to a non-root user via machinectl shell <user>@ .

The environmental variable is not set when:

  • Logged in as the root, and then switched to a non-root user via su -l <user>
  • Logged in as the root, and then switched to a non-root user via sudo -u <user>
  • Logged in as the root, and then switched to a non-root user via ksu <user>