普通用户运行doccker
普通用户运行doccker
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json?all=1": dial unix /var/run/docker.sock: connect: permission denied
[emporer@PROMETHEUS ~]$ docker ps -a
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json?all=1": dial unix /var/run/docker.sock: connect: permission denied
[emporer@PROMETHEUS ~]$ ll /var/run/docker.sock
srw-rw----. 1 root docker 0 Mar 29 00:29 /var/run/docker.sock
[emporer@PROMETHEUS ~]$ sudo usermod -aG docker emporer
[emporer@PROMETHEUS ~]$ docker ps -a
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json?all=1": dial unix /var/run/docker.sock: connect: permission denied
[emporer@PROMETHEUS ~]$ exit
logout
[root@PROMETHEUS ~]# su - emporer
Last login: Fri Mar 29 00:35:41 CST 2024 on pts/0
[emporer@PROMETHEUS ~]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc73acabc69e grafana/grafana "/run.sh" 3 days ago Up 8 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp grafana
5fa1d3226293 prom/prometheus "/bin/prometheus --c…" 3 days ago Up 8 minutes 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp prometheus
1f20bb54797b prom/node-exporter "/bin/node_exporter" 3 days ago Up 8 minutes 0.0.0.0:9100->9100/tcp, :::9100->9100/tcp node-exporter
[emporer@PROMETHEUS ~]$ ll /var/run/docker.sock
srw-rw----. 1 root docker 0 Mar 29 00:29 /var/run/docker.sock
[emporer@PROMETHEUS ~]$ id emporer
uid=1001(emporer) gid=1001(emporer) groups=1001(emporer),980(docker)
[emporer@PROMETHEUS ~]$
本文链接:
/archives/1711615248968
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
Emporer-Linux!
喜欢就支持一下吧