Docker package's systemd unit files don't work on Ubuntu

I used nix to install docker on Ubuntu 20.04, but the docker.service file is installed outside the systemd unit-path:
~/.nix-profile/etc/systemd/system/docker.service

After reading some posts I’m thinking that installing systemd unit files is not automatic on non-NixOS, So I tried to copy docker.service to /etc/systemd/system and start it manually. But:

  • The included docker.service is missing the matching docker.socket
    (at least from what I can see via nix edit nixpkgs.docker)
  • The ExecStart in the docker.service was not rewritten to point into /nix/store/…/dockerd/

After manually fetching the docker.socket, placing both files on the unit-path and patching the ExecStart manually, the dockerd started and works fine.

Is there some reason (maybe regarding NixOS of which I know nothing) to not include docker.socket and leave ExecStart unpatched?

Thanks

1 Like

It’s a known issue but nobody has so far bothered to submit a patch to fix it.

I’d happily review and merge it.

https://github.com/NixOS/nixpkgs/issues/70407

1 Like

Ah! I wish I saw that bug first. That’s what I see exactly. I’ll try and build a patch.
Thanks

1 Like

PR 120019

1 Like