centos stram 9:docker install

https://docs.docker.com/engine/install/centos/

1.install yum-utils
https://docs.docker.com/engine/install/centos/

# yum install -y yum-utils

2.install yum-config-manager
# yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3.install docker-ce

# yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin --skip-broken
Last metadata expiration check: 0:00:43 ago on Mon 04 Jul 2022 05:02:51 PM JST.
Dependencies resolved.
==================================================================================
 Package                  Arch      Version             Repository           Size
==================================================================================
Installing:
 docker-ce-cli            x86_64    1:20.10.17-3.el9    docker-ce-stable     29 M
 docker-compose-plugin    x86_64    2.6.0-3.el9         docker-ce-stable    6.9 M
Installing weak dependencies:
 docker-scan-plugin       x86_64    0.17.0-3.el9        docker-ce-stable    3.6 M

Transaction Summary
==================================================================================
Install  3 Packages

Total download size: 40 M
Installed size: 178 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): docker-scan-plugin-0.17.0-3.el9.x86_64.rpm 6.9 MB/s | 3.6 MB     00:00
(2/3): docker-compose-plugin-2.6.0-3.el9.x86_64.r  11 MB/s | 6.9 MB     00:00
(3/3): docker-ce-cli-20.10.17-3.el9.x86_64.rpm     24 MB/s |  29 MB     00:01
----------------------------------------------------------------------------------
Total                                              33 MB/s |  40 MB     00:01
Docker CE Stable - x86_64                          11 kB/s | 1.6 kB     00:00
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) "
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/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
  Installing       : docker-scan-plugin-0.17.0-3.el9.x86_64                   1/3
  Running scriptlet: docker-scan-plugin-0.17.0-3.el9.x86_64                   1/3
  Installing       : docker-ce-cli-1:20.10.17-3.el9.x86_64                    2/3
  Running scriptlet: docker-ce-cli-1:20.10.17-3.el9.x86_64                    2/3
  Installing       : docker-compose-plugin-2.6.0-3.el9.x86_64                 3/3
  Running scriptlet: docker-compose-plugin-2.6.0-3.el9.x86_64                 3/3
  Verifying        : docker-ce-cli-1:20.10.17-3.el9.x86_64                    1/3
  Verifying        : docker-compose-plugin-2.6.0-3.el9.x86_64                 2/3
  Verifying        : docker-scan-plugin-0.17.0-3.el9.x86_64                   3/3

Installed:
  docker-ce-cli-1:20.10.17-3.el9.x86_64  docker-compose-plugin-2.6.0-3.el9.x86_64
  docker-scan-plugin-0.17.0-3.el9.x86_64
Skipped:
  buildah-1.24.0-0.15.el9.x86_64      buildah-1:1.24.1-1.el9.x86_64
  buildah-1:1.25.1-1.el9.x86_64       buildah-1:1.26.1-3.el9.x86_64
  containerd.io-1.6.6-3.1.el9.x86_64  runc-2:1.0.0-332.dev.gitbd013b6.el9.x86_64
  runc-3:1.1.0-2.el9.x86_64           runc-4:1.0.3-4.el9.x86_64
  runc-4:1.0.3-5.el9.x86_64

Complete!
#

4.docker-ce install

[root@localhost document]# yum install docker-ce-20.10.17-3.el9 docker-ce-cli-20.10.17-3.el9 containerd.io docker-compose-plugin --allowerasing
Last metadata expiration check: 0:08:19 ago on Mon 04 Jul 2022 05:02:51 PM JST.
Package docker-ce-cli-1:20.10.17-3.el9.x86_64 is already installed.
Package docker-compose-plugin-2.6.0-3.el9.x86_64 is already installed.
Dependencies resolved.
==================================================================================
 Package                     Arch     Version            Repository          Size
==================================================================================
Installing:
 containerd.io               x86_64   1.6.6-3.1.el9      docker-ce-stable    32 M
     replacing  runc.x86_64 4:1.1.2-1.el9
 docker-ce                   x86_64   3:20.10.17-3.el9   docker-ce-stable    21 M
Installing dependencies:
 docker-ce-rootless-extras   x86_64   20.10.17-3.el9     docker-ce-stable   3.8 M
Removing dependent packages:
 buildah                     x86_64   1:1.26.1-4.el9     @appstream          29 M

Transaction Summary
==================================================================================
Install  3 Packages
Remove   1 Package

Total download size: 58 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): docker-ce-rootless-extras-20.10.17-3.el9.x 9.0 MB/s | 3.8 MB     00:00
(2/3): docker-ce-20.10.17-3.el9.x86_64.rpm         19 MB/s |  21 MB     00:01
(3/3): containerd.io-1.6.6-3.1.el9.x86_64.rpm      23 MB/s |  32 MB     00:01
----------------------------------------------------------------------------------
Total                                              40 MB/s |  58 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                          1/1
  Installing       : containerd.io-1.6.6-3.1.el9.x86_64                       1/5
  Running scriptlet: containerd.io-1.6.6-3.1.el9.x86_64                       1/5
  Installing       : docker-ce-rootless-extras-20.10.17-3.el9.x86_64          2/5
  Running scriptlet: docker-ce-rootless-extras-20.10.17-3.el9.x86_64          2/5
  Installing       : docker-ce-3:20.10.17-3.el9.x86_64                        3/5
  Running scriptlet: docker-ce-3:20.10.17-3.el9.x86_64                        3/5
  Erasing          : buildah-1:1.26.1-4.el9.x86_64                            4/5
  Obsoleting       : runc-4:1.1.2-1.el9.x86_64                                5/5
  Running scriptlet: runc-4:1.1.2-1.el9.x86_64                                5/5
  Verifying        : containerd.io-1.6.6-3.1.el9.x86_64                       1/5
  Verifying        : runc-4:1.1.2-1.el9.x86_64                                2/5
  Verifying        : docker-ce-3:20.10.17-3.el9.x86_64                        3/5
  Verifying        : docker-ce-rootless-extras-20.10.17-3.el9.x86_64          4/5
  Verifying        : buildah-1:1.26.1-4.el9.x86_64                            5/5

Installed:
  containerd.io-1.6.6-3.1.el9.x86_64
  docker-ce-3:20.10.17-3.el9.x86_64
  docker-ce-rootless-extras-20.10.17-3.el9.x86_64
Removed:
  buildah-1:1.26.1-4.el9.x86_64

Complete!

5.dockerのdeamon 起動

#  systemctl start docker
[root@localhost document]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3c21faea0d976f5c651
Status: Downloaded newer image for hello-world:latest

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/

#

6.dockerのinstatnce起動

# docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
405f018f9d1d: Pull complete
Digest: sha256:b6b83d3c331794420340093eb706a6f152d9c1fa51b262d9bf34594887c2c7ac
Status: Downloaded newer image for ubuntu:latest
root@bf90fe541fac:/#
# docker PS
CONTAINER ID   IMAGE     COMMAND   CREATED          STATUS          PORTS     NAMES
bf90fe541fac   ubuntu    "bash"    14 minutes ago   Up 14 minutes             focused_robinson
# docker inspect bf90fe541fac |grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.2",
                    "IPAddress": "172.17.0.2",
#

7.

# curl -fsSL https://get.docker.com -o get-docker.sh
# DRY_RUN=1 sh ./get-docker.sh
# Executing docker install script, commit: b2e29ef7a9a89840d2333637f7d1900a83e7153f
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.

You may press Ctrl+C now to abort this script.
+ sleep 20
yum install -y -q yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache
yum install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
# yum install -y -q yum-utils
# 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
# yum makecache
CentOS Stream 9 - BaseOS                          2.8 kB/s | 5.0 kB     00:01
CentOS Stream 9 - AppStream                        23 kB/s | 5.0 kB     00:00
CentOS Stream 9 - CRB                              15 kB/s | 4.9 kB     00:00
CentOS Stream 9 - Extras packages                 5.9 kB/s | 5.4 kB     00:00
Docker CE Stable - x86_64                          27 kB/s | 3.5 kB     00:00
Extra Packages for Enterprise Linux 9 - x86_64     20 kB/s | 6.7 kB     00:00
Extra Packages for Enterprise Linux 9 - Next - x8  38 kB/s |  10 kB     00:00
Remi's Modular repository for Enterprise Linux 9  508  B/s | 833  B     00:01
Safe Remi's RPM repository for Enterprise Linux 9 527  B/s | 833  B     00:01
Metadata cache created.
# yum install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
#

8. new login
- user07

$ pwd
/home/user07
$ sudo docker run -it ubuntu bash
root@bcb8ac524ec6:/# uname -a
Linux bcb8ac524ec6 5.14.0-142.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 4 18:15:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@bcb8ac524ec6:/# ps
    PID TTY          TIME CMD
      1 pts/0    00:00:00 bash
     10 pts/0    00:00:00 ps
root@bcb8ac524ec6:/# pwd

9. IPAddress

# docker inspect bcb8ac524ec6 |grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.2",
                    "IPAddress": "172.17.0.2",