无法在NixOS上无sudo权限运行Docker。

huangapple go评论61阅读模式
英文:

Can't run docker without sudo on NixOS

问题

我按照这个链接的说明:https://nixos.wiki/wiki/Docker,在我的configuration.nix文件中添加了以下内容:

users.users.<myUsername> = { # 我的实际用户名
    isNormalUser = true;
    description = "<myUsername>";
    extraGroups = [ "networkmanager" "wheel" "kvm" "libvirtd" "docker"];
    packages = with pkgs; [];
};
virtualisation.docker.enable = true;

并且在/etc/group文件中添加了:

docker:x:131:<myUsername>

我已经登入和登出,但每次仍然需要键入sudo?我对Nix和Linux都很陌生,不知道问题出在哪里。感谢任何帮助!

英文:

I followed this: https://nixos.wiki/wiki/Docker, and in my configuration.nix i have

users.users.&lt;myUsername&gt; = { #my actual username
    isNormalUser = true;
    description = &quot;&lt;myUsername&gt;&quot;;
    extraGroups = [ &quot;networkmanager&quot; &quot;wheel&quot; &quot;kvm&quot; &quot;libvirtd&quot; &quot;docker&quot;];
    packages = with pkgs; [];
  };
virtualisation.docker.enable = true;

and in /etc/group

docker:x:131:&lt;myUsername&gt;

I logged in and out but I still need to type sudo every time? I'm very new to nix and new-ish to linux and I have no idea what could be wrong. Any help is appreciated!

答案1

得分: 1

登录然后退出不足以解决问题。重新启动有效。

英文:

Logging in and back out was not enough. Restarting worked.

huangapple
  • 本文由 发表于 2023年6月26日 06:42:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76552684.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定