Docker는 솔로몬 하이크 라는 리눅스 개발자? 가 리눅스 컨테이너의 미래The Future of Linux Container라는 제목을 가진 이 발표에서 직접 docker 이미지와 커맨드를 이용해서 Hello World 를 출력하는 시현을 보여줌으로써 시작된다.
https://www.youtube.com/watch?time_continue=321&v=wW9CAH9nSLs&embeds_referring_euri=https%3A%2F%2Fwww.44bits.io%2Fko%2Fpost%2Fis-docker-container-a-virtual-machine-or-a-process&source_ve_path=MzY4NDIsMzY4NDIsMjg2NjY

.

\

.

.



설치 버전

# docker --version
Docker version 27.5.0, build a187fa5


도커를 설치하면 자동으로 docker 라는 그룹이 생긴다. (최신 꺼라 그런가?)
docker CLI를 root 권한 없이 사용하기 위한 기존 유저들은 docker 그룹에 추가를 하면 되는데, 아래처럼 추가해주면 된다.

sudo usermod -aG docker [유저명]

유저를 신규 생성하면서 도커라는 그룹에 넣고 싶다~ 하면, 아래처럼...

sudo adduser -g docker <new_username>

 

아래는 설치 과정들인데 별거 없다...
뭐 docker cli랑 플러그인이랑.. 등등 패키지를 설치해주면 된다.

수동으로 설치하는 것도 있던데, 여기서는 그냥 rpm 패키지 끌어다가 최신?버전으로 설치한 것이다.

수동 설치 방법도 아래 자료에 나와있다.
https://docs.docker.com/engine/install/rhel/#prerequisites

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

// --allowerasing - 지우는 거 허용하라는 건가? 싶어서 충돌되는 패키지 오버라이트 하기 위해 옵션 추가

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --allowerasing

oot@jwchoiTest ontunev4]# sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --allowerasing
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:55 ago on Tue 14 Jan 2025 08:03:34 PM EST.
Dependencies resolved.
===============================================================================================================================================================================================================
 Package                                                Architecture                        Version                                                                   Repository
===============================================================================================================================================================================================================
Installing:
 containerd.io                                          x86_64                              1.7.25-3.1.el8                                                            docker-ce-stable
     replacing  runc.x86_64 1:1.1.12-1.module+el8.10.0+21251+62b7388c
 docker-buildx-plugin                                   x86_64                              0.19.3-1.el8                                                              docker-ce-stable
 docker-ce                                              x86_64                              3:27.5.0-1.el8                                                            docker-ce-stable
 docker-ce-cli                                          x86_64                              1:27.5.0-1.el8                                                            docker-ce-stable
 docker-compose-plugin                                  x86_64                              2.32.3-1.el8                                                              docker-ce-stable
Installing dependencies:
 crun                                                   x86_64                              1.14.3-2.module+el8.10.0+22417+2fb00970                                   rhel-8-for-x86_64-appstream-rpms
 libcgroup                                              x86_64                              0.41-19.el8                                                               rhel-8-for-x86_64-baseos-rpms
Installing weak dependencies:
 criu-libs                                              x86_64                              3.18-4.module+el8.9.0+20326+387084d0                                      rhel-8-for-x86_64-appstream-rpms
 docker-ce-rootless-extras                              x86_64                              27.5.0-1.el8                                                              docker-ce-stable
Removing dependent packages:
 buildah                                                x86_64                              2:1.33.6-2.module+el8.10.0+21371+46937ece                                 @AppStream
 cockpit-podman                                         noarch                              84.1-1.module+el8.10.0+21373+0d273fdf                                     @AppStream
 podman                                                 x86_64                              3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1                                @AppStream
 podman-catatonit                                       x86_64                              3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1                                @AppStream
Downgrading:
 containers-common                                      x86_64                              1:1.2.2-10.module+el8.4.0+11311+9da8acfb                                  rhel-8-for-x86_64-appstream-rpms

Transaction Summary
===============================================================================================================================================================================================================
Install    9 Packages
Remove     4 Packages
Downgrade  1 Package

Total download size: 115 M
Is this ok [y/N]: y
Downloading Packages:
(1/10): containers-common-1.2.2-10.module+el8.4.0+11311+9da8acfb.x86_64.rpm                                                                                                    262 kB/s |  99 kB     00:00
(2/10): docker-buildx-plugin-0.19.3-1.el8.x86_64.rpm                                                                                                                            22 MB/s |  14 MB     00:00
(3/10): docker-ce-cli-27.5.0-1.el8.x86_64.rpm                                                                                                                                   12 MB/s | 8.1 MB     00:00
(4/10): docker-ce-27.5.0-1.el8.x86_64.rpm                                                                                                                                       25 MB/s |  28 MB     00:01
(5/10): docker-ce-rootless-extras-27.5.0-1.el8.x86_64.rpm                                                                                                                      9.8 MB/s | 5.1 MB     00:00
(6/10): docker-compose-plugin-2.32.3-1.el8.x86_64.rpm                                                                                                                           26 MB/s |  14 MB     00:00
(7/10): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                                                       238 kB/s |  70 kB     00:00
(8/10): containerd.io-1.7.25-3.1.el8.x86_64.rpm                                                                                                                                 18 MB/s |  45 MB     00:02
(9/10): crun-1.14.3-2.module+el8.10.0+22417+2fb00970.x86_64.rpm                                                                                                                691 kB/s | 258 kB     00:00
(10/10): criu-libs-3.18-4.module+el8.9.0+20326+387084d0.x86_64.rpm                                                                                                             8.1 kB/s |  39 kB     00:04
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                           17 MB/s | 115 MB     00:06
Docker CE Stable - x86_64                                                                                                                                                       22 kB/s | 1.6 kB     00:00
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/rhel/gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                       1/1
  Running scriptlet: docker-compose-plugin-2.32.3-1.el8.x86_64                                                                                                                                             1/1
  Installing       : docker-compose-plugin-2.32.3-1.el8.x86_64                                                                                                                                            1/16
  Running scriptlet: docker-compose-plugin-2.32.3-1.el8.x86_64                                                                                                                                            1/16
  Installing       : criu-libs-3.18-4.module+el8.9.0+20326+387084d0.x86_64                                                                                                                                2/16
  Installing       : crun-1.14.3-2.module+el8.10.0+22417+2fb00970.x86_64                                                                                                                                  3/16
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                                         4/16
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                                                                         4/16
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                                         4/16
  Installing       : docker-buildx-plugin-0.19.3-1.el8.x86_64                                                                                                                                             5/16
  Running scriptlet: docker-buildx-plugin-0.19.3-1.el8.x86_64                                                                                                                                             5/16
  Installing       : docker-ce-cli-1:27.5.0-1.el8.x86_64                                                                                                                                                  6/16
  Running scriptlet: docker-ce-cli-1:27.5.0-1.el8.x86_64                                                                                                                                                  6/16
  Installing       : containerd.io-1.7.25-3.1.el8.x86_64                                                                                                                                                  7/16
  Running scriptlet: containerd.io-1.7.25-3.1.el8.x86_64                                                                                                                                                  7/16
  Installing       : docker-ce-rootless-extras-27.5.0-1.el8.x86_64                                                                                                                                        8/16
  Running scriptlet: docker-ce-rootless-extras-27.5.0-1.el8.x86_64                                                                                                                                        8/16
  Installing       : docker-ce-3:27.5.0-1.el8.x86_64                                                                                                                                                      9/16
  Running scriptlet: docker-ce-3:27.5.0-1.el8.x86_64                                                                                                                                                      9/16
  Downgrading      : containers-common-1:1.2.2-10.module+el8.4.0+11311+9da8acfb.x86_64                                                                                                                   10/16
  Erasing          : buildah-2:1.33.6-2.module+el8.10.0+21371+46937ece.x86_64                                                                                                                            11/16
  Erasing          : cockpit-podman-84.1-1.module+el8.10.0+21373+0d273fdf.noarch                                                                                                                         12/16
  Running scriptlet: podman-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                            13/16
  Erasing          : podman-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                            13/16
  Running scriptlet: podman-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                            13/16
  Cleanup          : containers-common-2:1-81.module+el8.10.0+21340+c6c7475a.x86_64                                                                                                                      14/16
  Erasing          : podman-catatonit-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                  15/16
  Running scriptlet: podman-catatonit-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                  15/16
  Obsoleting       : runc-1:1.1.12-1.module+el8.10.0+21251+62b7388c.x86_64                                                                                                                               16/16
  Running scriptlet: runc-1:1.1.12-1.module+el8.10.0+21251+62b7388c.x86_64                                                                                                                               16/16
  Verifying        : containers-common-1:1.2.2-10.module+el8.4.0+11311+9da8acfb.x86_64                                                                                                                    1/16
  Verifying        : containers-common-2:1-81.module+el8.10.0+21340+c6c7475a.x86_64                                                                                                                       2/16
  Verifying        : containerd.io-1.7.25-3.1.el8.x86_64                                                                                                                                                  3/16
  Verifying        : runc-1:1.1.12-1.module+el8.10.0+21251+62b7388c.x86_64                                                                                                                                4/16
  Verifying        : docker-buildx-plugin-0.19.3-1.el8.x86_64                                                                                                                                             5/16
  Verifying        : docker-ce-3:27.5.0-1.el8.x86_64                                                                                                                                                      6/16
  Verifying        : docker-ce-cli-1:27.5.0-1.el8.x86_64                                                                                                                                                  7/16
  Verifying        : docker-ce-rootless-extras-27.5.0-1.el8.x86_64                                                                                                                                        8/16
  Verifying        : docker-compose-plugin-2.32.3-1.el8.x86_64                                                                                                                                            9/16
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                                                                        10/16
  Verifying        : criu-libs-3.18-4.module+el8.9.0+20326+387084d0.x86_64                                                                                                                               11/16
  Verifying        : crun-1.14.3-2.module+el8.10.0+22417+2fb00970.x86_64                                                                                                                                 12/16
  Verifying        : buildah-2:1.33.6-2.module+el8.10.0+21371+46937ece.x86_64                                                                                                                            13/16
  Verifying        : cockpit-podman-84.1-1.module+el8.10.0+21373+0d273fdf.noarch                                                                                                                         14/16
  Verifying        : podman-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                            15/16
  Verifying        : podman-catatonit-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64                                                                                                                  16/16
Installed products updated.

Downgraded:
  containers-common-1:1.2.2-10.module+el8.4.0+11311+9da8acfb.x86_64
Installed:
  containerd.io-1.7.25-3.1.el8.x86_64      criu-libs-3.18-4.module+el8.9.0+20326+387084d0.x86_64      crun-1.14.3-2.module+el8.10.0+22417+2fb00970.x86_64      docker-buildx-plugin-0.19.3-1.el8.x86_64
  docker-ce-3:27.5.0-1.el8.x86_64          docker-ce-cli-1:27.5.0-1.el8.x86_64                        docker-ce-rootless-extras-27.5.0-1.el8.x86_64            docker-compose-plugin-2.32.3-1.el8.x86_64
  libcgroup-0.41-19.el8.x86_64
Removed:
  buildah-2:1.33.6-2.module+el8.10.0+21371+46937ece.x86_64                  cockpit-podman-84.1-1.module+el8.10.0+21373+0d273fdf.noarch        podman-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64
  podman-catatonit-3:4.9.4-0.1.module+el8.10.0+21350+ea09fba1.x86_64

Complete!


# systemctl enable docker --now
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.


# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:5b3cc85e16e3058003c13b7821318369dad01dac3dbb877aac3c28182255c724
Status: Downloaded newer image for hello-world:latest

// 여기는 뭔가 docker 설치가 정상적으로 되었으며, 도커가 어떻게 작동하고 있는지 설명해주는 것 같다.

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/




 

계속 까먹네;