🥞 BE
home

Docker 설치 후 permission denied

도커를 설치한 후,
Got 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": dial unix /var/run/docker.sock: connect: permission denied
이런 오류가 뜰 때가 있다.
2가지 방법이 있다.
1.
usermod로 재접속한다.
sudo usermod -aG docker ${USER}
2.
docker sock permission denied이므로 이에 대한 permission을 준다.
sudo chmod 666 /var/run/docker.sock
user1@my-server:~$ docker ps Got 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": dial unix /var/run/docker.sock: connect: permission denied user1@my-server:~$ sudo chmod 666 /var/run/docker.sock user1@my-server:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Shell
복사
Docker-compose 설치 후 permission denied의 경우
chmod 755 /usr/local/bin/docker-compose
user1@my-server:~$ docker-compose -v -bash: /usr/local/bin/docker-compose: Permission denied user1@my-server:~$ sudo chmod +x /usr/local/bin/docker-compose user1@my-server:~$ docker-compose -v Docker Compose version v2.14.0
Shell
복사

Reference