CentOS7.7.1908-ppc64le成功安装docker

原文:https://mp.weixin.qq.com/s/SV3AY9g6hk6cE1WxjCT0Fg


服务器系统版本信息

[root@admin-instance-test-8 ~]# uname -a
Linux admin-instance-test-8.novalocal 3.10.0-1062.el7.ppc64le #1 SMP Thu Aug 8 10:25:39 UTC 2019 ppc64le ppc64le ppc64le GNU/Linux
[root@admin-instance-test-8 ~]#
[root@admin-instance-test-8 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (AltArch)
[root@admin-instance-test-8 ~]#

一、下面先安装docker(共10步)

第1步,卸载原来的旧版本docker

[root@admin-instance-test-8 ~]# yum remove docker \
>     docker-client \
>     docker-client-latest \
>     docker-common \
>     docker-latest \
>     docker-latest-logrotate \
>     docker-logrotate \
>     docker-selinux \
>     docker-engine-selinux \
>     docker-engine

第2步,安装基本工具

[root@admin-instance-test-8 ~]# yum install -y yum-utils \
> device-mapper-persistent-data \
> lvm2 

第3步,下载并安装container-selinux

[root@admin-instance-test-8 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/7/extras/ppc64le/Packages/container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm
[root@admin-instance-test-8 ~]# rpm -ivh container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm

查看是否成功安装container-selinux

[root@admin-instance-test-8 ~]# rpm -qa | grep container-selinux
container-selinux-2.119.1-1.c57a6f9.el7.noarch

第4步,下面开始安装docker

[root@admin-instance-test-8 ~]# yum -y install docker

看下安装过程

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package docker.ppc64le 2:1.13.1-161.git64e9980.el7_8 will be installed
--> Processing Dependency: docker-common = 2:1.13.1-161.git64e9980.el7_8 for package: 2:docker-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: docker-client = 2:1.13.1-161.git64e9980.el7_8 for package: 2:docker-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: subscription-manager-rhsm-certificates for package: 2:docker-1.13.1-161.git64e9980.el7_8.ppc64le
--> Running transaction check
---> Package docker-client.ppc64le 2:1.13.1-161.git64e9980.el7_8 will be installed
---> Package docker-common.ppc64le 2:1.13.1-161.git64e9980.el7_8 will be installed
--> Processing Dependency: skopeo-containers >= 1:0.1.26-2 for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: oci-umount >= 2:2.3.3-3 for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-9 for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: oci-register-machine >= 1:0-5.13 for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: container-storage-setup >= 0.9.0-1 for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
--> Processing Dependency: atomic-registries for package: 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le
---> Package subscription-manager-rhsm-certificates.ppc64le 0:1.24.26-3.el7.centos will be installed
--> Running transaction check
---> Package atomic-registries.ppc64le 1:1.22.1-33.gitb507039.el7_8 will be installed
--> Processing Dependency: python-pytoml for package: 1:atomic-registries-1.22.1-33.gitb507039.el7_8.ppc64le
---> Package container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7 will be installed
---> Package containers-common.ppc64le 1:0.1.40-7.el7_8 will be installed
--> Processing Dependency: subscription-manager for package: 1:containers-common-0.1.40-7.el7_8.ppc64le
--> Processing Dependency: slirp4netns for package: 1:containers-common-0.1.40-7.el7_8.ppc64le
--> Processing Dependency: fuse-overlayfs for package: 1:containers-common-0.1.40-7.el7_8.ppc64le
---> Package oci-register-machine.ppc64le 1:0-6.git2b44233.el7 will be installed
---> Package oci-systemd-hook.ppc64le 1:0.2.0-1.git05e6923.el7_6 will be installed
--> Processing Dependency: libyajl.so.2()(64bit) for package: 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.ppc64le
---> Package oci-umount.ppc64le 2:2.5-3.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.ppc64le 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.ppc64le
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.ppc64le
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.ppc64le
---> Package python-pytoml.noarch 0:0.1.14-1.git7dea353.el7 will be installed
---> Package slirp4netns.ppc64le 0:0.4.3-4.el7_8 will be installed
---> Package subscription-manager.ppc64le 0:1.24.26-3.el7.centos will be installed
--> Processing Dependency: subscription-manager-rhsm = 1.24.26 for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
--> Processing Dependency: usermode for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
--> Processing Dependency: python-syspurpose for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
--> Processing Dependency: python-inotify for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
--> Processing Dependency: python-ethtool for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
--> Processing Dependency: python-dateutil for package: subscription-manager-1.24.26-3.el7.centos.ppc64le
---> Package yajl.ppc64le 0:2.0.4-4.el7 will be installed
--> Running transaction check
---> Package fuse3-libs.ppc64le 0:3.6.1-4.el7 will be installed
---> Package python-dateutil.noarch 0:1.5-7.el7 will be installed
---> Package python-ethtool.ppc64le 0:0.8-8.el7 will be installed
--> Processing Dependency: libnl.so.1()(64bit) for package: python-ethtool-0.8-8.el7.ppc64le
---> Package python-inotify.noarch 0:0.9.4-4.el7 will be installed
---> Package python-syspurpose.ppc64le 0:1.24.26-3.el7.centos will be installed
---> Package subscription-manager-rhsm.ppc64le 0:1.24.26-3.el7.centos will be installed
---> Package usermode.ppc64le 0:1.111-6.el7 will be installed
--> Running transaction check
---> Package libnl.ppc64le 0:1.1.4-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
 Package                                       Arch           Version                               Repository      Size
=========================================================================================================================
Installing:
 docker                                        ppc64le        2:1.13.1-161.git64e9980.el7_8         extras          16 M
Installing for dependencies:
 atomic-registries                             ppc64le        1:1.22.1-33.gitb507039.el7_8          extras          35 k
 container-storage-setup                       noarch         0.11.0-2.git5eaf76c.el7               extras          35 k
 containers-common                             ppc64le        1:0.1.40-7.el7_8                      extras          42 k
 docker-client                                 ppc64le        2:1.13.1-161.git64e9980.el7_8         extras         3.4 M
 docker-common                                 ppc64le        2:1.13.1-161.git64e9980.el7_8         extras          99 k
 fuse-overlayfs                                ppc64le        0.7.2-6.el7_8                         extras          51 k
 fuse3-libs                                    ppc64le        3.6.1-4.el7                           extras          83 k
 libnl                                         ppc64le        1.1.4-3.el7                           base           131 k
 oci-register-machine                          ppc64le        1:0-6.git2b44233.el7                  extras         951 k
 oci-systemd-hook                              ppc64le        1:0.2.0-1.git05e6923.el7_6            extras          34 k
 oci-umount                                    ppc64le        2:2.5-3.el7                           extras          33 k
 python-dateutil                               noarch         1.5-7.el7                             base            85 k
 python-ethtool                                ppc64le        0.8-8.el7                             base            33 k
 python-inotify                                noarch         0.9.4-4.el7                           base            49 k
 python-pytoml                                 noarch         0.1.14-1.git7dea353.el7               extras          18 k
 python-syspurpose                             ppc64le        1.24.26-3.el7.centos                  updates        269 k
 slirp4netns                                   ppc64le        0.4.3-4.el7_8                         extras          78 k
 subscription-manager                          ppc64le        1.24.26-3.el7.centos                  updates        1.1 M
 subscription-manager-rhsm                     ppc64le        1.24.26-3.el7.centos                  updates        327 k
 subscription-manager-rhsm-certificates        ppc64le        1.24.26-3.el7.centos                  updates        231 k
 usermode                                      ppc64le        1.111-6.el7                           base           195 k
 yajl                                          ppc64le        2.0.4-4.el7                           base            36 k

Transaction Summary
=========================================================================================================================
Install  1 Package (+22 Dependent packages)

Total download size: 23 M
Installed size: 87 M
Downloading packages:
(1/23): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch.rpm                                |  35 kB  00:00:00
(2/23): atomic-registries-1.22.1-33.gitb507039.el7_8.ppc64le.rpm                                  |  35 kB  00:00:00
(3/23): containers-common-0.1.40-7.el7_8.ppc64le.rpm                                              |  42 kB  00:00:00
(4/23): docker-common-1.13.1-161.git64e9980.el7_8.ppc64le.rpm                                     |  99 kB  00:00:00
(5/23): fuse-overlayfs-0.7.2-6.el7_8.ppc64le.rpm                                                  |  51 kB  00:00:00
(6/23): fuse3-libs-3.6.1-4.el7.ppc64le.rpm                                                        |  83 kB  00:00:00
(7/23): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.ppc64le.rpm                                     |  34 kB  00:00:00
(8/23): oci-umount-2.5-3.el7.ppc64le.rpm                                                          |  33 kB  00:00:00
(9/23): oci-register-machine-0-6.git2b44233.el7.ppc64le.rpm                                       | 951 kB  00:00:00
(10/23): python-ethtool-0.8-8.el7.ppc64le.rpm                                                     |  33 kB  00:00:00
(11/23): python-inotify-0.9.4-4.el7.noarch.rpm                                                    |  49 kB  00:00:00
(12/23): docker-client-1.13.1-161.git64e9980.el7_8.ppc64le.rpm                                    | 3.4 MB  00:00:00
(13/23): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm                                         |  18 kB  00:00:00
(14/23): python-dateutil-1.5-7.el7.noarch.rpm                                                     |  85 kB  00:00:00
(15/23): slirp4netns-0.4.3-4.el7_8.ppc64le.rpm                                                    |  78 kB  00:00:00
(16/23): python-syspurpose-1.24.26-3.el7.centos.ppc64le.rpm                                       | 269 kB  00:00:00
(17/23): subscription-manager-rhsm-1.24.26-3.el7.centos.ppc64le.rpm                               | 327 kB  00:00:00
(18/23): subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.ppc64le.rpm                  | 231 kB  00:00:00
(19/23): yajl-2.0.4-4.el7.ppc64le.rpm                                                             |  36 kB  00:00:00
(20/23): subscription-manager-1.24.26-3.el7.centos.ppc64le.rpm                                    | 1.1 MB  00:00:00
(21/23): docker-1.13.1-161.git64e9980.el7_8.ppc64le.rpm                                           |  16 MB  00:00:04
(22/23): libnl-1.1.4-3.el7.ppc64le.rpm                                                            | 131 kB  00:00:05
(23/23): usermode-1.111-6.el7.ppc64le.rpm                                                         | 195 kB  00:00:05
-------------------------------------------------------------------------------------------------------------------------
Total                                                                                    3.1 MB/s |  23 MB  00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:
MariaDB-server-10.3.0-1.ael7b.ppc64le has missing requires of lsof
MariaDB-server-10.3.0-1.ael7b.ppc64le has missing requires of perl(DBI)
MariaDB-server-10.3.0-1.ael7b.ppc64le has missing requires of perl(Data::Dumper)
MariaDB-test-10.3.0-1.ael7b.ppc64le has missing requires of perl(Data::Dumper)
  Installing : yajl-2.0.4-4.el7.ppc64le                                                                             1/23
  Installing : subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.ppc64le                                  2/23
  Installing : python-dateutil-1.5-7.el7.noarch                                                                     3/23
  Installing : subscription-manager-rhsm-1.24.26-3.el7.centos.ppc64le                                               4/23
  Installing : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.ppc64le                                                  5/23
  Installing : 2:oci-umount-2.5-3.el7.ppc64le                                                                       6/23
  Installing : fuse3-libs-3.6.1-4.el7.ppc64le                                                                       7/23
  Installing : fuse-overlayfs-0.7.2-6.el7_8.ppc64le                                                                 8/23
  Installing : usermode-1.111-6.el7.ppc64le                                                                         9/23
  Installing : python-pytoml-0.1.14-1.git7dea353.el7.noarch                                                        10/23
  Installing : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.ppc64le                                              11/23
  Installing : 1:oci-register-machine-0-6.git2b44233.el7.ppc64le                                                   12/23
  Installing : libnl-1.1.4-3.el7.ppc64le                                                                           13/23
  Installing : python-ethtool-0.8-8.el7.ppc64le                                                                    14/23
  Installing : slirp4netns-0.4.3-4.el7_8.ppc64le                                                                   15/23
  Installing : python-inotify-0.9.4-4.el7.noarch                                                                   16/23
  Installing : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch                                              17/23
  Installing : python-syspurpose-1.24.26-3.el7.centos.ppc64le                                                      18/23
  Installing : subscription-manager-1.24.26-3.el7.centos.ppc64le                                                   19/23
  Installing : 1:containers-common-0.1.40-7.el7_8.ppc64le                                                          20/23
  Installing : 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le                                                 21/23
  Installing : 2:docker-client-1.13.1-161.git64e9980.el7_8.ppc64le                                                 22/23
pam_tally2: Couldn't create /var/log/tallylog: Permission denied
pam_tally2: Authentication error
useradd: failed to reset the tallylog entry of user "dockerroot"
  Installing : 2:docker-1.13.1-161.git64e9980.el7_8.ppc64le                                                        23/23
  Verifying  : 2:docker-client-1.13.1-161.git64e9980.el7_8.ppc64le                                                  1/23
  Verifying  : python-syspurpose-1.24.26-3.el7.centos.ppc64le                                                       2/23
  Verifying  : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch                                               3/23
  Verifying  : python-inotify-0.9.4-4.el7.noarch                                                                    4/23
  Verifying  : slirp4netns-0.4.3-4.el7_8.ppc64le                                                                    5/23
  Verifying  : libnl-1.1.4-3.el7.ppc64le                                                                            6/23
  Verifying  : python-dateutil-1.5-7.el7.noarch                                                                     7/23
  Verifying  : 2:docker-common-1.13.1-161.git64e9980.el7_8.ppc64le                                                  8/23
  Verifying  : 1:oci-register-machine-0-6.git2b44233.el7.ppc64le                                                    9/23
  Verifying  : python-pytoml-0.1.14-1.git7dea353.el7.noarch                                                        10/23
  Verifying  : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.ppc64le                                                 11/23
  Verifying  : subscription-manager-1.24.26-3.el7.centos.ppc64le                                                   12/23
  Verifying  : subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.ppc64le                                 13/23
  Verifying  : usermode-1.111-6.el7.ppc64le                                                                        14/23
  Verifying  : 2:docker-1.13.1-161.git64e9980.el7_8.ppc64le                                                        15/23
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.ppc64le                                                                16/23
  Verifying  : python-ethtool-0.8-8.el7.ppc64le                                                                    17/23
  Verifying  : yajl-2.0.4-4.el7.ppc64le                                                                            18/23
  Verifying  : subscription-manager-rhsm-1.24.26-3.el7.centos.ppc64le                                              19/23
  Verifying  : fuse3-libs-3.6.1-4.el7.ppc64le                                                                      20/23
  Verifying  : 1:containers-common-0.1.40-7.el7_8.ppc64le                                                          21/23
  Verifying  : 2:oci-umount-2.5-3.el7.ppc64le                                                                      22/23
  Verifying  : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.ppc64le                                              23/23

Installed:
  docker.ppc64le 2:1.13.1-161.git64e9980.el7_8

Dependency Installed:
  atomic-registries.ppc64le 1:1.22.1-33.gitb507039.el7_8
  container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7
  containers-common.ppc64le 1:0.1.40-7.el7_8
  docker-client.ppc64le 2:1.13.1-161.git64e9980.el7_8
  docker-common.ppc64le 2:1.13.1-161.git64e9980.el7_8
  fuse-overlayfs.ppc64le 0:0.7.2-6.el7_8
  fuse3-libs.ppc64le 0:3.6.1-4.el7
  libnl.ppc64le 0:1.1.4-3.el7
  oci-register-machine.ppc64le 1:0-6.git2b44233.el7
  oci-systemd-hook.ppc64le 1:0.2.0-1.git05e6923.el7_6
  oci-umount.ppc64le 2:2.5-3.el7
  python-dateutil.noarch 0:1.5-7.el7
  python-ethtool.ppc64le 0:0.8-8.el7
  python-inotify.noarch 0:0.9.4-4.el7
  python-pytoml.noarch 0:0.1.14-1.git7dea353.el7
  python-syspurpose.ppc64le 0:1.24.26-3.el7.centos
  slirp4netns.ppc64le 0:0.4.3-4.el7_8
  subscription-manager.ppc64le 0:1.24.26-3.el7.centos
  subscription-manager-rhsm.ppc64le 0:1.24.26-3.el7.centos
  subscription-manager-rhsm-certificates.ppc64le 0:1.24.26-3.el7.centos
  usermode.ppc64le 0:1.111-6.el7
  yajl.ppc64le 0:2.0.4-4.el7

Complete!
[root@admin-instance-test-8 ~]#

第5步,查看docker状态

[root@admin-instance-test-8 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://docs.docker.com
[root@admin-instance-test-8 ~]#

第6步,启动docker

[root@admin-instance-test-8 ~]# systemctl start docker

查看docker状态

[root@admin-instance-test-8 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-06-09 22:18:33 CST; 2s ago
     Docs: http://docs.docker.com
 Main PID: 12536 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─12536 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --defaul...
           └─12545 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock -...

Jun 09 22:18:31 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:31.183099333+08:00" l...5"
Jun 09 22:18:32 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:32.580333793+08:00" l...s"
Jun 09 22:18:32 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:32.582806066+08:00" l...."
Jun 09 22:18:32 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:32.686152519+08:00" l...e"
Jun 09 22:18:33 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:33.036279904+08:00" l...s"
Jun 09 22:18:33 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:33.192542407+08:00" l...."
Jun 09 22:18:33 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:33.360308275+08:00" l...n"
Jun 09 22:18:33 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:33.360399404+08:00" l....1
Jun 09 22:18:33 admin-instance-test-8.novalocal dockerd-current[12536]: time="2020-06-09T22:18:33.368507842+08:00" l...k"
Jun 09 22:18:33 admin-instance-test-8.novalocal systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@admin-instance-test-8 ~]#

第7步,查看docker版本

[root@admin-instance-test-8 ~]# docker --version
Docker version 1.13.1, build 64e9980/1.13.1
[root@admin-instance-test-8 ~]#

第8步,添加docker加速器,快速拉取镜像

[root@admin-instance-test-8 ~]# cat /etc/docker/daemon.json
{}
[root@admin-instance-test-8 ~]#
[root@admin-instance-test-8 ~]# vim /etc/docker/daemon.json
[root@admin-instance-test-8 ~]#
[root@admin-instance-test-8 ~]# cat /etc/docker/daemon.json
{
  "registry-mirrors":["https://bjtzu1jb.mirror.aliyuncs.com"]
}
[root@admin-instance-test-8 ~]#

第9步,加载daemon

[root@admin-instance-test-8 ~]# systemctl daemon-reload
[root@admin-instance-test-8 ~]#

第10步,重启docker

[root@admin-instance-test-8 ~]# systemctl restart docker
[root@admin-instance-test-8 ~]#

查看docker状态

[root@admin-instance-test-8 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-06-10 09:10:27 CST; 40s ago
     Docs: http://docs.docker.com
 Main PID: 13949 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─13949 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --de...
           └─13956 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.so...

Jun 10 09:10:25 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:25.858064217+08:0...6"
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.034820784+08:0...s"
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.037422270+08:0...."
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.051528376+08:0...e"
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.253420993+08:0...s"
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.402728994+08:0...."
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.534569288+08:0...n"
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.534662247+08:0....1
Jun 10 09:10:27 admin-instance-test-8.novalocal dockerd-current[13949]: time="2020-06-10T09:10:27.555073987+08:0...k"
Jun 10 09:10:27 admin-instance-test-8.novalocal systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@admin-instance-test-8 ~]#

二、下面是搜索、拉取、删除镜像(共4步)

第1步,docker搜索tomcat镜像

[root@admin-instance-test-8 ~]# docker search tomcat
INDEX       NAME                                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/tomcat                        Apache Tomcat is an open source implementa...   2747      [OK]
docker.io   docker.io/tomee                         Apache TomEE is an all-Apache Java EE cert...   79        [OK]
docker.io   docker.io/dordoka/tomcat                Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba...   54                   [OK]
docker.io   docker.io/bitnami/tomcat                Bitnami Tomcat Docker Image                     34                   [OK]
docker.io   docker.io/kubeguide/tomcat-app          Tomcat image for Chapter 1                      28
docker.io   docker.io/consol/tomcat-7.0             Tomcat 7.0.57, 8080, "admin/admin"              17                   [OK]
docker.io   docker.io/cloudesire/tomcat             Tomcat server, 6/7/8                            15                   [OK]
docker.io   docker.io/aallam/tomcat-mysql           Debian, Oracle JDK, Tomcat & MySQL              13                   [OK]
docker.io   docker.io/arm32v7/tomcat                Apache Tomcat is an open source implementa...   10
docker.io   docker.io/rightctrl/tomcat              CentOS , Oracle Java, tomcat application s...   6                    [OK]
docker.io   docker.io/maluuba/tomcat7-java8         Tomcat7 with java8.                             5
docker.io   docker.io/unidata/tomcat-docker         Security-hardened Tomcat Docker container.      4                    [OK]
docker.io   docker.io/amd64/tomcat                  Apache Tomcat is an open source implementa...   2
docker.io   docker.io/arm64v8/tomcat                Apache Tomcat is an open source implementa...   2
docker.io   docker.io/jelastic/tomcat               An image of the Tomcat Java application se...   2
docker.io   docker.io/99taxis/tomcat7               Tomcat7                                         1                    [OK]
docker.io   docker.io/camptocamp/tomcat-logback     Docker image for tomcat with logback integ...   1                    [OK]
docker.io   docker.io/i386/tomcat                   Apache Tomcat is an open source implementa...   1
docker.io   docker.io/oobsri/tomcat8                Testing CI Jobs with different names.           1
docker.io   docker.io/ppc64le/tomcat                Apache Tomcat is an open source implementa...   1
docker.io   docker.io/appsvc/tomcat                                                                 0
docker.io   docker.io/cfje/tomcat-resource          Tomcat Concourse Resource                       0
docker.io   docker.io/picoded/tomcat7               tomcat7 with jre8 and MANAGER_USER / MANAG...   0                    [OK]
docker.io   docker.io/s390x/tomcat                  Apache Tomcat is an open source implementa...   0
docker.io   docker.io/secoresearch/tomcat-varnish   Tomcat and Varnish 5.0                          0                    [OK]
[root@admin-instance-test-8 ~]#

第2步,docker拉取tomcat8镜像

[root@admin-instance-test-8 ~]# docker pull docker.io/ppc64le/tomcat:8
Trying to pull repository docker.io/ppc64le/tomcat ...
8: Pulling from docker.io/ppc64le/tomcat
c6c4df30bc4f: Pull complete
bb8b6d64c781: Pull complete
663d68dc2e12: Pull complete
b98e4e060b9a: Pull complete
f8e24f3bccdd: Pull complete
c5f7a6e570ea: Pull complete
fb5a3232b209: Pull complete
0cda852fcd5f: Pull complete
1191f65b01e5: Pull complete
33ecf9079ecd: Pull complete
d4e234dd1f90: Pull complete
Digest: sha256:12c0026bedf11769580724301255ea7c0408f4eadb46f7ca7b9f575d3b0ea688
Status: Downloaded newer image for docker.io/ppc64le/tomcat:8
[root@admin-instance-test-8 ~]#

第3步,查看docker镜像

[root@admin-instance-test-8 ~]# docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
docker.io/ppc64le/tomcat   8                   8259e86df6f9        13 months ago       492 MB
[root@admin-instance-test-8 ~]#

第4步,如果要删除docker镜像(根据镜像ID删除即可)

[root@admin-instance-test-8 ~]# docker rmi -f 8259e86df6f9

三、接下来是创建并启动tomcat容器(共6步)

第1步,先关掉selinux防火墙(临时)

[root@admin-instance-test-8 ~]# setenforce 0

第2步,创建并启动tomcat8容器

[root@admin-instance-test-8 ~]# docker run -d --name tomcat8 -p 8008:8080 -v /root/software-tomcat:/usr/local/tomcat/webapps docker.io/ppc64le/tomcat:8
a1d3148a554a1830c21c1a980baae0649eb330d0c987b656d9f4b74419d45f5e
[root@admin-instance-test-8 ~]#

参数说明

参数 含义
-d 就是在后台运行容器
--name 指定docker名字
-p 指定端口映射,hostport:containerport
-v 指定(新建一个)本地目录映射到容器目录

查看docker容器进程

[root@admin-instance-test-8 ~]# docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS                    NAMES
a1d3148a554a        docker.io/ppc64le/tomcat:8   "catalina.sh run"   5 seconds ago       Up 3 seconds        0.0.0.0:8008->8080/tcp   tomcat8
[root@admin-instance-test-8 ~]#

第3步,进入docker容器

[root@admin-instance-test-8 ~]# docker exec -it tomcat8 /bin/bash
root@a1d3148a554a:/usr/local/tomcat#
root@a1d3148a554a:/usr/local/tomcat# ls
BUILDING.txt  CONTRIBUTING.md  LICENSE  NOTICE  README.md  RELEASE-NOTES  RUNNING.txt  bin  conf  include  lib  logs  native-jni-lib  temp  webapps  work
root@a1d3148a554a:/usr/local/tomcat#

第4步,退出docker容器

[root@admin-instance-test-8 ~]# exit
exit
[root@admin-instance-test-8 ~]#

第5步,停止docker容器(根据docker的NAMES)

[root@admin-instance-test-8 ~]# docker stop tomcat8
tomcat8
[root@admin-instance-test-8 ~]#

查看docker容器进程

[root@admin-instance-test-8 ~]# docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS                       PORTS               NAMES
a1d3148a554a        docker.io/ppc64le/tomcat:8   "catalina.sh run"   3 minutes ago       Exited (143) 5 seconds ago                       tomcat8
[root@admin-instance-test-8 ~]#

第6步,删除docker容器(根据docker的NAMES)

[root@admin-instance-test-8 ~]# docker rm tomcat8
tomcat8
[root@admin-instance-test-8 ~]#

查看docker容器进程

[root@admin-instance-test-8 ~]# docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS                  NAMES
[root@admin-instance-test-8 ~]#

 

 


— —

待续……

创作辛苦!

您的每一个点赞就是我努力的前进动力!

更多精彩,请关注本博主!

微信公众号也已开通,正在更新ing,欢迎关注「码农coding」!
CentOS7.7.1908-ppc64le成功安装docker_第1张图片

你可能感兴趣的:(docker,Linux)