I'm using Debian on WSL. Nix is already install.

I install docker with this command:

nix-env -iA nixpkgs.docker

I want to start the daemon :

systemctl start docker

Failed to connect to bus: No such file or directory


FYI $XDG_RUNTIME_DIR= /mnt/wslg/runtime-dir $UID=1000 $DBUS_SESSION_BUS_ADDRESS has no value

ls -l /mnt/wslg/runtime-dir

drwx------ 4 pierre pierre 120 Dec 26 00:41 runtime-dir

I can access the bus. But I need to use sudo

sudo systemctl start docker

Now I have this problem

Failed to start docker.service: Unit docker.service not found.

I think docker.service is this file: /etc/systemd/system/docker.service

But it doesn't exist on my OS. I'Ve tried to uninstall and reinstall docker with nix. To no avails

I think that it is linked:


sudo cp ~/.nix-profile/etc/systemd/system/docker.service /etc/systemd/system/docker.service

sudo cp ~/.nix-profile/etc/systemd/system/docker.sock /var/run/docker.sock

sudo systemctl enable docker

 Failed to start docker.service: Unit docker.socket not found.

Failed to start docker.service: Unit docker.socket not found.

After reading this link, I use this command in order to the know where I should replace docker.socket file. :

 systemctl list-sockets --all

But no docker.socket is listed


I have made all the commands from scratch. Now I have this problem A dependency job for docker.service failed. See 'journalctl -xe' for details.

4 Answers 4


If I understood the problem correctly, you have to set your XDG_RUNTIME_DIR manually (because /run/user/... is sometimes owned by some other user?? (Not quite sure to be honest)):

So can you try to set XDG_RUNTIME_DIR = "/run/user/$UID" and then starting nix again?

If that doesn't work you maybe have to set DBUS_SESSION_BUS_ADDRESS as well to DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus".

You can find a similar thread to yours here: https://superuser.com/questions/1561076/systemctl-user-failed-to-connect-to-bus-no-such-file-or-directory-debian-9

Did that help/fixed your problem?


You must look for directory, use cd .. and go to /bin/, there is your program, then start use ./docker or systemctl start docker.

sudo groupadd docker
sudo chgrp docker docker.sock
sudo systemctl start docker

No error message


you need to modify the default docker.service, for example, by changing the startup parameters


ExecStart=/home/xx/.nix-profile/bin/dockerd -H unix:///var/run/docker.sock

may be you need to reload

sudo systemctl daemon-reload

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .