본문 바로가기

리눅스

Docker 데몬 소켓 연결 권한 거부

반응형

Docker 데몬 소켓 연결 권한 거부

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

 

  • Docker 컨테이너의 목록을 표시
docker ps -a
$ 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.24/containers/json?all=1": dial unix /var/run/docker.sock: connect: permission denied
  • 파일의 권한과 소유자 정보를 나열
ls -l /var/run/docker.sock
$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jan 23 14:28 /var/run/docker.sock
  • Docker 데몬 소켓에 권한 부여(/var/run/docker.sock)
sudo chmod 666 /var/run/docker.sock
$ ls -l /var/run/docker.sock
srw-rw-rw- 1 root docker 0 Feb  1 13:17 /var/run/docker.sock
  • Docker 컨테이너의 목록을 표시
docker ps
$ docker ps
CONTAINER ID   IMAGE                      COMMAND                  CREATED        STATUS        PORTS                                                                          NAMES
b158bb6a2a92   anti1346/centos7:systemd   "/usr/lib/systemd/sy…"   18 hours ago   Up 18 hours   0.0.0.0:2222->22/tcp, :::2222->22/tcp, 0.0.0.0:8082->80/tcp, :::8082->80/tcp   centos7-systemd

 

728x90
반응형