-
[Docker] CentOS 7 Docker 설치IT 발자취.../서버운영 2020. 4. 1. 09:51
Docker 설치
### yum 패키지 업데이트 # yum update ### Docker, Docker registry 설치 # yum install docker docker-registry
Docker 실행 및 자동 실행 설정
### 부팅시 실행하도록 등록 # systemctl enable docker.service Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. ### 도커 실행 # systemctl start docker.service ### 도커 상태 확인 # systemctl status docker.service
일반 유저에게 권한 위임
docker가 root 계정으로 설치 되었을때 root 계정이 아닌 계정으로 docker를 실행하면 아래와 같은 에러가 발생할 수 있다. 이 경우 user에게 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.26/images/create?fromImage=jenkins&tag=latest: dial unix /var/run/docker.sock: connect: permission denied
---
$ docker run hello-world 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.26/images/create?fromImage=jenkins&tag=latest: dial unix /var/run/docker.sock: connect: permission denied $ ls -al /var/run/docker.sock srw-rw----. 1 root docker 0 Apr 1 01:05 /var/run/docker.sock ### Docker 그룹 생성 $ sudo groupadd docker ### 유저에게 Docker 그룹 권한 추가 $ sudo usermod -aG docker ${USER} ## 로그아웃 후 재로그인 $ id uid=1000(---) gid=1000(---) groups=1000(---),10(wheel),1001(docker) $ docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
'IT 발자취... > 서버운영' 카테고리의 다른 글
[Jenkins] Elasticsearch-Kibana를 이용한 로그 모니터링 (2) (0) 2020.04.09 [Jenkins] Elasticsearch-Kibana를 이용한 로그 모니터링 (1) (0) 2020.04.01 댓글