mutao.net

いわゆる雑記。

CentOS8環境にdockerを入れる

docker入れたい

dnfコマンドを使って入れていく。

本当はansibleで入れてみたかったけどとりあえず動かしたいので入れる。

repository登録

$ dnf 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
$ dnf repolist
repo id                                                                                                repo name
appstream                                                                                              CentOS Linux 8 - AppStream
baseos                                                                                                 CentOS Linux 8 - BaseOS
docker-ce-stable                                                                                       Docker CE Stable - aarch64
extras                                                                                                 CentOS Linux 8 - Extras
[root@localhost ~]# dnf -y install docker-ce docker-ce-cli containerd.io
Docker CE Stable - aarch64                                                                                                                                                              24 kB/s | 9.2 kB     00:00
Last metadata expiration check: 0:00:01 ago on Sun 07 Feb 2021 10:18:59 AM UTC.
Dependencies resolved.
=======================================================================================================================================================================================================================
 Package                                                  Architecture                        Version                                                               Repository                                    Size
=======================================================================================================================================================================================================================
Installing:
 containerd.io                                            aarch64                             1.4.3-3.1.el8                                                         docker-ce-stable                              26 M
 docker-ce                                                aarch64                             3:20.10.3-3.el8                                                       docker-ce-stable                              18 M
 docker-ce-cli                                            aarch64                             1:20.10.3-3.el8                                                       docker-ce-stable                              29 M
Installing dependencies:
 checkpolicy                                              aarch64                             2.9-1.el8                                                             baseos                                       338 k
 container-selinux                                        noarch                              2:2.144.0-1.module_el8.3.0+475+c50ce30b                               appstream                                     49 k
 docker-ce-rootless-extras                                aarch64                             20.10.3-3.el8                                                         docker-ce-stable                             8.3 M
 fuse-overlayfs                                           aarch64                             1.1.2-3.module_el8.3.0+507+aa0970ae                                   appstream                                     62 k
 fuse3-libs                                               aarch64                             3.2.1-12.el8                                                          baseos                                        90 k
 libcgroup                                                aarch64                             0.41-19.el8                                                           baseos                                        68 k
 libslirp                                                 aarch64                             4.3.1-1.module_el8.3.0+475+c50ce30b                                   appstream                                     65 k
 policycoreutils-python-utils                             noarch                              2.9-9.el8                                                             baseos                                       251 k
 python3-audit                                            aarch64                             3.0-0.17.20191104git1c2f876.el8                                       baseos                                        84 k
 python3-libsemanage                                      aarch64                             2.9-3.el8                                                             baseos                                       124 k
 python3-policycoreutils                                  noarch                              2.9-9.el8                                                             baseos                                       2.2 M
 python3-setools                                          aarch64                             4.3.0-2.el8                                                           baseos                                       528 k
 slirp4netns                                              aarch64                             1.1.4-2.module_el8.3.0+475+c50ce30b                                   appstream                                     49 k
 tar                                                      aarch64                             2:1.30-5.el8                                                          baseos                                       829 k
Enabling module streams:
 container-tools                                                                              rhel8

Transaction Summary
=======================================================================================================================================================================================================================
Install  17 Packages
...
Installed:
  checkpolicy-2.9-1.el8.aarch64                                          container-selinux-2:2.144.0-1.module_el8.3.0+475+c50ce30b.noarch             containerd.io-1.4.3-3.1.el8.aarch64
  docker-ce-3:20.10.3-3.el8.aarch64                                      docker-ce-cli-1:20.10.3-3.el8.aarch64                                        docker-ce-rootless-extras-20.10.3-3.el8.aarch64
  fuse-overlayfs-1.1.2-3.module_el8.3.0+507+aa0970ae.aarch64             fuse3-libs-3.2.1-12.el8.aarch64                                              libcgroup-0.41-19.el8.aarch64
  libslirp-4.3.1-1.module_el8.3.0+475+c50ce30b.aarch64                   policycoreutils-python-utils-2.9-9.el8.noarch                                python3-audit-3.0-0.17.20191104git1c2f876.el8.aarch64
  python3-libsemanage-2.9-3.el8.aarch64                                  python3-policycoreutils-2.9-9.el8.noarch                                     python3-setools-4.3.0-2.el8.aarch64
  slirp4netns-1.1.4-2.module_el8.3.0+475+c50ce30b.aarch64                tar-2:1.30-5.el8.aarch64

Complete!

dockerのサービス登録

[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@localhost ~]# 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 Sun 2021-02-07 10:21:44 UTC; 9s ago
     Docs: https://docs.docker.com
 Main PID: 3783 (dockerd)
    Tasks: 13
   CGroup: /system.slice/docker.service
           └─3783 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Feb 07 10:21:42 localhost dockerd[3783]: time="2021-02-07T10:21:42.099871862Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Feb 07 10:21:42 localhost dockerd[3783]: time="2021-02-07T10:21:42.099895528Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Feb 07 10:21:42 localhost dockerd[3783]: time="2021-02-07T10:21:42.100400981Z" level=info msg="Loading containers: start."
Feb 07 10:21:43 localhost dockerd[3783]: time="2021-02-07T10:21:43.366532114Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferr>
Feb 07 10:21:43 localhost dockerd[3783]: time="2021-02-07T10:21:43.650196576Z" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Feb 07 10:21:43 localhost dockerd[3783]: time="2021-02-07T10:21:43.969715664Z" level=info msg="Loading containers: done."
Feb 07 10:21:44 localhost dockerd[3783]: time="2021-02-07T10:21:44.080269229Z" level=info msg="Docker daemon" commit=46229ca graphdriver(s)=overlay2 version=20.10.3
Feb 07 10:21:44 localhost dockerd[3783]: time="2021-02-07T10:21:44.080964865Z" level=info msg="Daemon has completed initialization"
Feb 07 10:21:44 localhost systemd[1]: Started Docker Application Container Engine.
Feb 07 10:21:44 localhost dockerd[3783]: time="2021-02-07T10:21:44.190011069Z" level=info msg="API listen on /var/run/docker.sock"

[root@localhost ~]# docker --version
Docker version 20.10.3, build 48d30b5