[Docker] yum기반으로 설치하는 방법 소개
Linux 에서 Docker 설치하는 방법 정리한 자료로 Docker 공식홈페이지에 있는 자료를 기반으로 작성하였다.
테스트 수행한 환경
- 인터넷가능한 환경, Rocky Linux 8.6, root계정 (일반계정으로 설치 실행시 sudo를 앞에 붙여야한다.)
1. 기존에 설치된 Docker가 있으면 삭제하기
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc
2. yum util update 및 docker repo추가
- ubuntu와 centos 에서 –add-repo하는 부분이 약간 상이함
[root@rocky8: ~]# yum install -y yum-utils
Last metadata expiration check: 1:43:21 ago on Tue 11 Apr 2023 02:09:25 PM KST.
Package yum-utils-4.0.21-14.1.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@rocky8: ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
3. docker 관련 모듈 설치
[root@rocky8: ~]# yum --noplugins install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Docker CE Stable - x86_64 95 kB/s | 3.5 kB 00:00
Package docker-ce-3:23.0.3-1.el8.x86_64 is already installed.
Package docker-ce-cli-1:23.0.3-1.el8.x86_64 is already installed.
Package containerd.io-1.6.20-3.1.el8.x86_64 is already installed.
Package docker-compose-plugin-2.17.2-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
4. systemctl 로 등록( 재부팅시 자동시작하도록)
## systemctl 등록 후 실행
[root@rocky8: ~]# systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
## 점검하기
[root@rocky8: ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2023-04-11 15:54:55 KST; 10s ago
Docs: https://docs.docker.com
Main PID: 1825 (dockerd)
Tasks: 9
Memory: 122.3M
CGroup: /system.slice/docker.service
└─1825 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.365685091+09:00" level=info msg="[core] [Channel #4] Channel Connectivity change to READY" module=grpc
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.395253767+09:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.398537184+09:00" level=info msg="Loading containers: start."
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.623137329+09:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Dae>
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.668006052+09:00" level=info msg="Loading containers: done."
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.712710407+09:00" level=info msg="Docker daemon" commit=59118bf graphdriver=overlay2 version=23.0.3
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.712868633+09:00" level=info msg="Daemon has completed initialization"
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.725880181+09:00" level=info msg="[core] [Server #7] Server created" module=grpc
Apr 11 15:54:55 rocky8.linuxvmimages.local systemd[1]: Started Docker Application Container Engine.
Apr 11 15:54:55 rocky8.linuxvmimages.local dockerd[1825]: time="2023-04-11T15:54:55.729298075+09:00" level=info msg="API listen on /run/docker.sock"
5. Docker-compose 모듈 다운로드 후 심볼릭 링크 연결
[root@rocky8: ~]# curl -L "https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 51.9M 100 51.9M 0 0 14.8M 0 0:00:03 0:00:03 --:--:-- 17.0M
[root@rocky8: ~]# chmod +x /usr/local/bin/docker-compose
[root@rocky8: ~]# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
6. 정상설치여부 점검
- 아래 명령어가 정상적으로 구동되는지 점검한다.
docker ps
docker-compose ls
댓글남기기