10

I installed docker on nixos, using:

nix-env -i docker

after that, dockerd was not running, so I started the daemon manually with:

dockerd

and in the logs, I see:

WARN[2019-06-26T01:02:31.784701442Z] could not change group /var/run/docker.sock to docker: group docker not found

should I care about this warning?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

3 Answers3

16

When installing docker on NixOS, it's best to enable it in the NixOS configuration. Doing so will install docker as a system service.

Snippet for /etc/nixos/configuration.nix:

virtualisation.docker.enable = true;

# ...

users.users.YOU = { # merge this with your unix user definition, "YOU" is for illustration
  isNormalUser = true;
  # ...
  extraGroups = [
    # ...
    "docker"
  ];
};
arthur simas
  • 132
  • 5
Robert Hensing
  • 6,708
  • 18
  • 23
  • I am pretty sure (but less than 100%) you will need to create the docker group as well. – emory Jul 12 '19 at 00:14
  • 2
    The docker module creates the group for you: https://github.com/NixOS/nixpkgs/blob/6702acaf561f7a1326d5745031549bb7147f1882/nixos/modules/virtualisation/docker.nix#L154 – Robert Hensing Jul 13 '19 at 10:53
3

created a group docker. Docker needs that user group to start as a service.

deosha
  • 972
  • 5
  • 20
1

Make sure to restart your computer, and not just logout-login, to actually make sudo-less docker work.

Rounak Datta
  • 442
  • 7
  • 10