728x90
docker, docker-compose 설치 방법은 아래 글 참고
1. Docker 설치 후 Permission denied
docker 설치가 끝난 뒤 docker ps 를 확인했을때 permission denied error 발생하면 docker 그룹에 user를 추가한다.
sudo usermod -aG docker ${USER}
해당 계정으로 재접속하면 permission denied error 없이 docker 사용 가능
user1@my-server:~$ docker -v
Docker version 20.10.22, build 3a2c30b
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 usermod -aG docker user1
user1@my-server:~# cat /etc/group | grep docker
docker:x:136:user1
(재접속 후 docker ps 확인)
user1@my-server:~$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
위 명령어로 문제 해결이 안되면 /var/run/docker.sock에 권한 부여한다.
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
2. Docker-compose 설치 후 Permission denied
docker-compose 설치가 끝난 뒤 Permission denied error가 발생하면
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
https://stackoverflow.com/questions/59265190/permission-denied-in-docker-compose-on-linux
728x90
'Docker' 카테고리의 다른 글
Docker private(local) registry/Harbor 구축 (0) | 2023.03.17 |
---|---|
[Docker] 다른 서버의 도커 이미지 가져오기-docker save, load (0) | 2023.01.24 |
docker, docker-compose 설치 on Ubuntu (0) | 2022.12.19 |
도커 이미지/컨테이너 생성 삭제 (with Portainer) (1) | 2022.12.08 |
Docker network 생성 / container IP 확인 (0) | 2022.10.01 |