본문 바로가기
Technical/System

Linux(Rocky8.6) Docker 설치

by 채희창 2024. 9. 27.

 

Linux(Rocky8.6)에 Docker 설치하는 방법에 대하여 포스팅하겠습니다.

  • Docker는 VMware와 동일하게 가상화 환경을 지원하지만 VMware와는 다르게 독립된 환경에서 실행할 수 있도록 도와주는 소프트웨어 플랫폼입니다. 
  • Docker를 사용하면 애플리케이션을 신속하게 구축 및 배포할 수 있습니다. VMware(가상머신) 보다 가볍고 빠르며, 리소스 사용률이 높아 효율적입니다.

Docker 설치

1. yum-utils 패키지 설치(yum-config-manager Utilities 제공)

[root@localhost ~]# sudo yum install -y yum-utils
Rocky Linux 8 - AppStream
Rocky Linux 8 - BaseOS
Rocky Linux 8 - Extras
Dependencies resolved.
=========================================================================================================================================================================================
 Package                                                             Architecture                                      Version                                                  Repositor
=========================================================================================================================================================================================
Installing:
 yum-utils                                                           noarch                                            4.0.21-25.el8                                            baseos
Upgrading:
 dnf-plugins-core                                                    noarch                                            4.0.21-25.el8                                            baseos
 python3-dnf-plugins-core                                            noarch                                            4.0.21-25.el8                                            baseos

Transaction Summary
=========================================================================================================================================================================================
Install  1 Package
Upgrade  2 Packages

Total download size: 412 k
Downloading Packages:
(1/3): dnf-plugins-core-4.0.21-25.el8.noarch.rpm
(2/3): yum-utils-4.0.21-25.el8.noarch.rpm
(3/3): python3-dnf-plugins-core-4.0.21-25.el8.noarch.rpm
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total
Rocky Linux 8 - BaseOS
Importing GPG key 0x6D745A60:
 Userid     : "Release Engineering <infrastructure@rockylinux.org>"
 Fingerprint: 7051 C470 A929 F454 CEBE 37B7 15AF 5DAC 6D74 5A60
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :
  Upgrading        : python3-dnf-plugins-core-4.0.21-25.el8.noarch
  Upgrading        : dnf-plugins-core-4.0.21-25.el8.noarch
  Installing       : yum-utils-4.0.21-25.el8.noarch
  Cleanup          : dnf-plugins-core-4.0.21-11.el8.noarch
  Cleanup          : python3-dnf-plugins-core-4.0.21-11.el8.noarch
  Running scriptlet: python3-dnf-plugins-core-4.0.21-11.el8.noarch
  Verifying        : yum-utils-4.0.21-25.el8.noarch
  Verifying        : dnf-plugins-core-4.0.21-25.el8.noarch
  Verifying        : dnf-plugins-core-4.0.21-11.el8.noarch
  Verifying        : python3-dnf-plugins-core-4.0.21-25.el8.noarch
  Verifying        : python3-dnf-plugins-core-4.0.21-11.el8.noarch

Upgraded:
  dnf-plugins-core-4.0.21-25.el8.noarch                                                                          python3-dnf-plugins-core-4.0.21-25.el8.noarch
Installed:
  yum-utils-4.0.21-25.el8.noarch

Complete!
 

2. Docker repository 추가

[root@localhost ~]# sudo 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. 추가된 repository 확인

경로: "cd /etc/yum.rpos.d/"에 "docker-ce.repo" repository가 생성된 것을 확인할 수 있습니다. 

4. Docker Engine 및 컨테이너, Docker Compose 설치

[root@localhost yum.repos.d]# sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
 

Error가 발생할 경우(Podman 삭제)

  • Rocky 8.x 버전부터는 "Podman 데몬"과 포트가 겹쳐서 "error"가 발생할 수 있습니다.
  •  “Error: Problem 1: problem with installed package podman”로 인하여 진행되지 않을 경우

 

yum remove buildah skopeo podman containers-common atomic-registries docker container-tools

 

 

rm -rf /etc/containers/* /var/lib/containers/* /etc/docker /etc/subuid* /etc/subgid*

 

 

cd ~ && rm -rf /.local/share/containers/

 

 

 5. docker 시작 및 활성화

[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker

 6. Docker Test

[root@localhost ~]# 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/

 

Rocky8.6에 Docker 설치하는 방법에 대해서 포스팅하였습니다.

 

감사합니다.

댓글