美文网首页
Linux使用usermod获得权限

Linux使用usermod获得权限

作者: kinkyboots | 来源:发表于2017-11-20 17:53 被阅读30次

    https://techoverflow.net/2017/03/01/solving-docker-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket/

    Problem:

    You are trying to run a docker container or do the docker tutorial, but you only get an error message like this:

    docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
    
    See 'docker run --help'.
    

    Solution:

    The error message tells you that your current user can’t access the docker engine, because you’re lacking permissions to access the unix socket to communicate with the engine.

    As a temporary solution, you can usesudoto run the failed command as root.

    However it is recommended to fix the issue byadding the current user to thedockergroup:

    Run this command in your favourite shell and thencompletely log out of your account and log back in(if in doubt, reboot!):

    
    sudo usermod -a -G docker $USER
    
    

    After doing that, you should be able to run the command without any issues. Rundocker run hello-worldas a normal user in order to check if it works. Reboot if the issue still persists.

    Logging out and logging back in is required because the group change will not have an effect unless your session is closed.

    相关文章

      网友评论

          本文标题:Linux使用usermod获得权限

          本文链接:https://www.haomeiwen.com/subject/vwtbvxtx.html