2、docker安装

摘要:
Docker在CentOS-6.5或更高版本CentOS上运行。查看自己的内核uname命令用于打印有关当前系统的信息(内核版本号、硬件架构、主机名、操作系统类型等)。
1、安装前提

CentOS Docker 安装
Docker支持以下的CentOS版本:
CentOS 7 (64-bit)
CentOS 6.5 (64-bit) 或更高的版本

前提条件
目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。

查看自己的内核
uname命令用于打印当前系统相关信息(内核版本号、硬件架构、主机名称和操作系统类型等)。
2、docker安装第1张

查看已安装的CentOS版本信息(CentOS6.8有,CentOS7无该命令)
2、docker安装第2张

2、安装步骤
2.1 CentOS6.8

2、docker安装第3张

1)yum install -y epel-release

Docker使用EPEL发布,RHEL系的OS首先要确保已经持有EPEL仓库,否则先检查OS的版本,然后安装相应的EPEL包。
2、docker安装第4张

2)yum install docker-io

2、docker安装第5张

3)/etc/sysconfig/docker

2、docker安装第6张

4)启动docker后台服务

service docker start

5)docker version验证

2、docker安装第7张

2.2 CentOS8.0

2、docker安装第8张

最新的安装地址(CentOS8)
https://docs.docker.com/engine/install/centos/
2、docker安装第9张
2、docker安装第10张

sudo yum install -y yum-utils
[root@localhost ~]# sudo yum install -y yum-utils
CentOS-8 - AppStream                                                                                                                   1.0 MB/s | 6.6 MB     00:06    
CentOS-8 - Base                                                                                                                        588 kB/s | 5.0 MB     00:08    
CentOS-8 - Extras                                                                                                                      5.0 kB/s | 4.9 kB     00:00    
依赖关系解决。
=======================================================================================================================================================================
 软件包                                   架构                                  版本                                       仓库                                   大小
=======================================================================================================================================================================
安装:
 yum-utils                                noarch                                4.0.8-3.el8                                BaseOS                                 64 k

事务概要
=======================================================================================================================================================================
安装  1 软件包

总下载:64 k
安装大小:19 k
下载软件包:
yum-utils-4.0.8-3.el8.noarch.rpm                                                                                                       145 kB/s |  64 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                    54 kB/s |  64 kB     00:01     
警告:/var/cache/dnf/BaseOS-929b586ef1f72f69/packages/yum-utils-4.0.8-3.el8.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
CentOS-8 - Base                                                                                                                        142 kB/s | 1.6 kB     00:00    
导入 GPG 公钥 0x8483C65D:
 Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>"
 指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
导入公钥成功
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                        1/1 
  安装    : yum-utils-4.0.8-3.el8.noarch                                                                                                                           1/1 
  运行脚本: yum-utils-4.0.8-3.el8.noarch                                                                                                                           1/1 
  验证    : yum-utils-4.0.8-3.el8.noarch                                                                                                                           1/1 

已安装:
  yum-utils-4.0.8-3.el8.noarch                                                                                                                                         

完毕!

sudo yum-config-manager
[root@localhost ~]# sudo yum-config-manager 
>     --add-repo 
>     https://download.docker.com/linux/centos/docker-ce.repo
添加仓库自:https://download.docker.com/linux/centos/docker-ce.repo
[root@localhost ~]# 

2、docker安装第11张

切换阿里云镜像

[root@localhost ~]# sudo yum-config-manager 
>     --add-repo 
>     https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
1、CentOS8 INSTALL DOCKER ENGINE

Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

1.1安装遇到错误问题1:package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed

[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io
CentOS-8 - AppStream                                                                                                                   5.7 kB/s | 4.3 kB     00:00    
CentOS-8 - Base                                                                                                                        4.8 kB/s | 3.8 kB     00:00    
CentOS-8 - Extras                                                                                                                      1.4 kB/s | 1.5 kB     00:01    
Docker CE Stable - x86_64                                                                                                              8.2 kB/s |  22 kB     00:02    
错误:
 问题: package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  - package containerd.io-1.2.13-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
###问题分析
centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了
安装containerd.io即可
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm

[root@localhost ~]# yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.10-3.2.fc30.x86_64.rpm
上次元数据过期检查:0:24:10 前,执行于 2020年04月09日 星期四 02时44分09秒。
containerd.io-1.2.10-3.2.fc30.x86_64.rpm                                                                                                20 kB/s |  23 MB     19:18    
依赖关系解决。
=======================================================================================================================================================================
 软件包                                   架构                              版本                                         仓库                                     大小
=======================================================================================================================================================================
安装:
 containerd.io                            x86_64                            1.2.10-3.2.fc30                              @commandline                             23 M
     替换  runc.x86_64 1.0.0-60.rc8.module_el8.1.0+237+63e26edc

事务概要
=======================================================================================================================================================================
安装  1 软件包

总计:23 M
确定吗?[y/N]: y
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                        1/1 
  安装    : containerd.io-1.2.10-3.2.fc30.x86_64                                                                                                                   1/2 
  运行脚本: containerd.io-1.2.10-3.2.fc30.x86_64                                                                                                                   1/2 
  废弃    : runc-1.0.0-60.rc8.module_el8.1.0+237+63e26edc.x86_64                                                                                                   2/2 
  运行脚本: runc-1.0.0-60.rc8.module_el8.1.0+237+63e26edc.x86_64                                                                                                   2/2 
  验证    : containerd.io-1.2.10-3.2.fc30.x86_64                                                                                                                   1/2 
  验证    : runc-1.0.0-60.rc8.module_el8.1.0+237+63e26edc.x86_64                                                                                                   2/2 

已安装:
  containerd.io-1.2.10-3.2.fc30.x86_64                                                                                                                                 

完毕!

1.2 安装遇到错误问题2

安装过程中出现 错误:事务检查错误:

卸载podman

错误:事务检查错误:
  file /usr/share/man/man1/docker-attach.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch

docker与podman冲突,podman也是容器技术,貌似比docker先进,先卸载。

[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io
上次元数据过期检查:0:01:01 前,执行于 2020年04月09日 星期四 03时50分39秒。
软件包 containerd.io-1.2.10-3.2.fc30.x86_64 已安装。
依赖关系解决。
=======================================================================================================================================================================
 软件包                                  架构                             版本                                        仓库                                        大小
=======================================================================================================================================================================
安装:
 docker-ce                               x86_64                           3:19.03.8-3.el7                             docker-ce-stable                            25 M
 docker-ce-cli                           x86_64                           1:19.03.8-3.el7                             docker-ce-stable                            40 M
安装依赖关系:
 libcgroup                               x86_64                           0.41-19.el8                                 BaseOS                                      70 k

事务概要
=======================================================================================================================================================================
安装  3 软件包

总下载:64 M
安装大小:273 M
确定吗?[y/N]: y
下载软件包:
(1/3): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                 62 kB/s |  70 kB     00:01    
(2/3): docker-ce-19.03.8-3.el7.x86_64.rpm                                                                                              1.6 MB/s |  25 MB     00:15    
(3/3): docker-ce-cli-19.03.8-3.el7.x86_64.rpm                                                                                          2.0 MB/s |  40 MB     00:19    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                   3.2 MB/s |  64 MB     00:20     
警告:/var/cache/dnf/docker-ce-stable-3e5647bf4960c796/packages/docker-ce-19.03.8-3.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                                               16 kB/s | 1.6 kB     00:00    
导入 GPG 公钥 0x621E9F35:
 Userid: "Docker Release (CE rpm) <docker@docker.com>"
 指纹: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 来自: https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
确定吗?[y/N]: y
导入公钥成功
运行事务检查
事务检查成功。
运行事务测试
下载的软件包保存在缓存中,直到下次成功执行事务。
您可以通过执行 'dnf clean packages' 删除软件包缓存。
错误:事务检查错误:
  file /usr/share/man/man1/docker-attach.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-build.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-commit.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-container-prune.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-container.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-cp.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-create.1.gz from install of docker-ce-cli-1:19.03.8-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch

............................................................................................





[root@dev1 docker-19.03.8-rpm]# rpm -q podman
podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64

[root@dev1 docker-19.03.8-rpm]# yum remove podman
[root@localhost ~]# yum remove podman
模块依赖问题

 问题 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020191114033549:073fa5fe-0.x86_64
 问题 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020191113222731:16b3ab4d-0.x86_64
依赖关系解决。
=======================================================================================================================================================================
 软件包                             架构                     版本                                                                   仓库                          大小
=======================================================================================================================================================================
移除:
 podman                             x86_64                   1.4.2-5.module_el8.1.0+237+63e26edc                                    @AppStream                    51 M
移除依赖的软件包:
 cockpit-podman                     noarch                   4-1.module_el8.1.0+237+63e26edc                                        @AppStream                   5.1 M
清除未被使用的依赖关系:
 libvarlink                         x86_64                   18-3.el8                                                               @anaconda                    129 k
 oci-systemd-hook                   x86_64                   1:0.1.15-2.git2d0b8a3.module_el8.1.0+237+63e26edc                      @AppStream                    74 k
 podman-manpages                    noarch                   1.4.2-5.module_el8.1.0+237+63e26edc                                    @AppStream                   134 k

事务概要
=======================================================================================================================================================================
移除  5 软件包

将会释放空间:56 M
确定吗?[y/N]: y
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                        1/1 
  运行脚本: cockpit-podman-4-1.module_el8.1.0+237+63e26edc.noarch                                                                                                  1/1 
  删除    : cockpit-podman-4-1.module_el8.1.0+237+63e26edc.noarch                                                                                                  1/5 
  删除    : podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64                                                                                                      2/5 
  运行脚本: podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64                                                                                                      2/5 
  删除    : podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch                                                                                             3/5 
  删除    : oci-systemd-hook-1:0.1.15-2.git2d0b8a3.module_el8.1.0+237+63e26edc.x86_64                                                                              4/5 
  删除    : libvarlink-18-3.el8.x86_64                                                                                                                             5/5 
  运行脚本: libvarlink-18-3.el8.x86_64                                                                                                                             5/5 
  验证    : cockpit-podman-4-1.module_el8.1.0+237+63e26edc.noarch                                                                                                  1/5 
  验证    : libvarlink-18-3.el8.x86_64                                                                                                                             2/5 
  验证    : oci-systemd-hook-1:0.1.15-2.git2d0b8a3.module_el8.1.0+237+63e26edc.x86_64                                                                              3/5 
  验证    : podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64                                                                                                      4/5 
  验证    : podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch                                                                                             5/5 

已移除:
  podman-1.4.2-5.module_el8.1.0+237+63e26edc.x86_64                           cockpit-podman-4-1.module_el8.1.0+237+63e26edc.noarch        libvarlink-18-3.el8.x86_64  
  oci-systemd-hook-1:0.1.15-2.git2d0b8a3.module_el8.1.0+237+63e26edc.x86_64   podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch  

完毕!
[root@localhost ~]# 

1.3 正确的完整安装过程

[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io
上次元数据过期检查:0:08:45 前,执行于 2020年04月09日 星期四 03时50分39秒。
软件包 containerd.io-1.2.10-3.2.fc30.x86_64 已安装。
依赖关系解决。
=======================================================================================================================================================================
 软件包                                  架构                             版本                                        仓库                                        大小
=======================================================================================================================================================================
安装:
 docker-ce                               x86_64                           3:19.03.8-3.el7                             docker-ce-stable                            25 M
 docker-ce-cli                           x86_64                           1:19.03.8-3.el7                             docker-ce-stable                            40 M
安装依赖关系:
 libcgroup                               x86_64                           0.41-19.el8                                 BaseOS                                      70 k

事务概要
=======================================================================================================================================================================
安装  3 软件包

总计:64 M
安装大小:273 M
确定吗?[y/N]: y
下载软件包:
[SKIPPED] libcgroup-0.41-19.el8.x86_64.rpm: Already downloaded                                                                                                        
[SKIPPED] docker-ce-19.03.8-3.el7.x86_64.rpm: Already downloaded                                                                                                      
[SKIPPED] docker-ce-cli-19.03.8-3.el7.x86_64.rpm: Already downloaded                                                                                                  
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                   6.3 GB/s |  64 MB     00:00     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                        1/1 
  安装    : docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                                                   1/3 
  运行脚本: docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                                                   1/3 
  运行脚本: libcgroup-0.41-19.el8.x86_64                                                                                                                           2/3 
  安装    : libcgroup-0.41-19.el8.x86_64                                                                                                                           2/3 
  运行脚本: libcgroup-0.41-19.el8.x86_64                                                                                                                           2/3 
  安装    : docker-ce-3:19.03.8-3.el7.x86_64                                                                                                                       3/3 
  运行脚本: docker-ce-3:19.03.8-3.el7.x86_64                                                                                                                       3/3 
  验证    : libcgroup-0.41-19.el8.x86_64                                                                                                                           1/3 
  验证    : docker-ce-3:19.03.8-3.el7.x86_64                                                                                                                       2/3 
  验证    : docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                                                   3/3 

已安装:
  docker-ce-3:19.03.8-3.el7.x86_64                       docker-ce-cli-1:19.03.8-3.el7.x86_64                       libcgroup-0.41-19.el8.x86_64                      

完毕!
启动Docker
[root@localhost ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?


[root@localhost ~]# systemctl start docker
[root@localhost ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:25:42 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
helloworld
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
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/

[root@localhost ~]# 
docker images
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        15 months ago       1.84kB

免责声明:文章转载自《2、docker安装》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇win32下的OpenGL绘图环境框架oracle--10安装问题下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

oracle锁

1.概念 数据库中有两种基本的锁类型:排它锁(Exclusive Locks,即X锁)和共享锁(Share Locks,即S锁)。 当数据对象被加上排它锁时,其他的事务不能对它读取和修改;加了共享锁的数据对象可以被其他事务读取,但不能修改。 根据保护对象的不同,Oracle数据库锁可以分为以下几大类: 1) DML lock(data locks,数据锁)...

Vue之日历控件vue-full-calendar的使用

(1).安装依赖 npm install vue-full-calendar  npm install moment 因为这是日历插件用到了时间工具类 === moment  (2).文件中导入依赖 在想要用此插件的文件中导入依赖 import { FullCalendar } from 'vue-full-calendar' import "f...

网络渗透资料大全单——漏洞库篇

漏洞库 NVD        ——美国国家漏洞库      →http://nvd.nist.gov/。 CERT        ——美国国家应急响应中心      →https://www.us-cert.gov/ OSVDB        ——开源漏洞库      →http://osvdb.org Bugtraq        —...

【Mysql数据库】知识点总结

本文转载自:http://www.cnblogs.com/tonghun/p/7191131.html一 数据库常用操作 mysql -u+username -p+password:登陆数据库管理系统,如mysql -uroot -p123。 create database dbName:创建数据库。 drop database dbName:删除数...

spring中使用异步事件实现同步事务

在Spring中使用异步事件实现同步事务 结合Scala+Spring,我们将采取一个很简单的场景:下订单,然后发送一封电子邮件。 编制一个服务: @Service class OrderService @Autowired() (orderDao: OrderDao, mailNotifier: OrderMailNotifier) { @Transac...

IntraWeb.v14.0.32安装及破解指南

一、下载   首先从这里下载14.0.32版本的IntraWeb:   链接:http://pan.baidu.com/s/1c0rjnKO 密码:8kv2 二、卸载旧版   1. 我的Delphi版本是XE6,解压缩下载的程序,进入“IWBundledRemovalTool”文件夹,运行“IWBundledRemovalTool.exe”,卸载旧版。...