请参考:
https://blog.csdn.net/u013948858/article/details/78429954
问题:安装Docker之后,执行docker run hello-world 命令,权限报错。
daemonnnn@daemonnnn-virtual-machine:~$ docker --version Docker version 18.09.3, build 774a1f4 daemonnnn@daemonnnn-virtual-machine:~$ docker run hello-world 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.39/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See ‘docker run --help‘.
原因:
安装完Docker后,有个提示:
当要以非root用户可以直接运行docker时,需要执行 sudo usermod -aG docker runoob 命令,然后重新登陆,否则会有报错。
If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker runoob Remember that you will have to log out and back in for this to take effect!
Docker使用问题记录贴
原文地址:https://www.cnblogs.com/daemonFlY/p/10459902.html
时间: 2024-11-01 12:28:29