I am trying to install Docker daemon as non root user, following this guide: https://docs.docker.com/engine/security/rootless/

First, I removed the existing rootful docker daemon.

Then I created a user called docker-user and made it a member of docker group

Then I switched to shell for that docker-user like so:

sudo -iu docker-user

And ran the rootless docker installation script given at the link above.

Script output:

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

Looking at the script, the line systemd not detected, dockerd daemon needs to be started manually is output if systemctl --user daemon-reload falis

The output of systemctl --user daemon-reload is

docker-user@ubuntu:~$ systemctl --user daemon-reload
Failed to connect to bus: No such file or directory

I don't want to start docker manually, it should run as a service like the usual docker installation. As per the guide, I should be able to run it as a service. What am I doing wrong?

  • The Failed to connect to bus message is a bit misleading - the acutal problem is missing root permissions to run daemon-reload.
    – Panki
    May 19 '20 at 14:12
  • 1
    But this user should not need root permission. It is not clear which user this command should be run as. I was assuming it is the non-root user.
    – Dojo
    May 19 '20 at 14:17
  • What distro are you setting this up on?
    – Panki
    May 19 '20 at 14:17
  • Tried with Ubuntu 18.04 and then with a fresh Ubuntu 20.04 VM
    – Dojo
    May 19 '20 at 14:46
  • Hello @Dojo, sorry I have the same kind of issue with this. How did you remove the existing rootful docker daemon? Please advice.
    – hridayns
    May 21 at 16:21

This issue is caused by $XDG_RUNTIME_DIR not being set to /run/user/$UID BEFORE rootless Docker is installed.

Switching to a user with su - $USER will NOT automatically set $XDG_RUNTIME_DIR, which can cause this issue.

The warning messages that result from installing rootless Docker without setting $XDG_RUNTIME_DIR properly suggest trying export XDG_RUNTIME_DIR=/home/$USER/.docker/run, which will NOT fix the issue. This is also why this issue usually occurs when attempting to install rootless Docker on a new user.

Instead, do the following:

  1. Set $XDG_RUNTIME_DIR to /run/user/$UID

    export XDG_RUNTIME_DIR=/run/user/$UID

    Note that logging in via ssh (as mentioned in the accepted answer) will automatically do this, but su - $USER will NOT, thus leading to the original issue of $XDG_RUNTIME_DIR not being set.

  2. Verify $XDG_RUNTIME_DIR is set with echo $XDG_RUNTIME_DIR. This should print something like /run/user/1001.

  3. Install rootless Docker, according to the instructions:

    curl -fsSL https://get.docker.com/rootless | sh

    Note that if you already improperly installed rootless Docker, this will result in the following:

    # To reinstall or upgrade rootless Docker, run the following commands and then rerun the installation script:
    systemctl --user stop docker
    rm -f /home/$USER/bin/dockerd

    If this happens, follow the instructions to uninstall rootless Docker with the rm command. Then, try installing again with step 3.


You need to login via ssh as the non-root user and then run the script.

sudo -iu docker-user

ssh docker-user@hostname

(docker-user is an example, use any non root user that exists on the target system)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.