Dokcer安装及遇到的问题

安装Docker

版本信息

Linux version 4.18.0-193.14.2.el8_2.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC))

安装准备

1.卸载之前的版本信息

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2.安装yum-utils软件包(提供yum-config-manager 实用程序)并设置稳定的存储库。

yum install -y yum-utils device-mapper-persistent-data lvm2

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
或
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo


#更新yum软件包索引------可省略
yum makecache fast

如果这是自添加 Docker 镜像仓库以来您首次刷新软件包索引,系统将提示您接受 GPG 密钥,并且将显示此密钥的指纹。验证指纹是否正确,并且在正确的情况下接受此密钥。指纹应匹配 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35。

 3.安装DOCKER引擎

yum install docker-ce docker-ce-cli containerd.io

 4.启动容器

systemctl start docker
#开机自启
systemctl enable docker

 5.测试容器

docker run hello-world

安装指定版本-查看所有的docker版本信息,寻找稳定的版本安装

#查看docker-ce版本信息
yum list docker-ce --showduplicates | sort -r
#安装
yum install -y docker-ce  #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0
yum install  -y <FQPN>  # 例如:sudo yum install docker-ce-17.12.0.ce

 配置阿里云镜像加速

mkdir  -p  /etc/docker
vi  /etc/docker/daemon.json
#添加以下内容
{"registry-mirrors": 
["https://5f2jam6c.mirror.aliyuncs.com", 
"http://hub-mirror.c.163.com"]
}
#重新加载配置文件
systemctl reload  docker
#重启docker
systemctl restart docker

常见报错信息

 package docker-ce-3:19.03.2-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.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

要么安装老版本的docker-ce,要么升级containerd.io

#查看版本信息
yum list docker-ce --showduplicates | sort -r
#安装低版本的docker-ce
yum -y install  docker-ce-18.06.0.ce-3.el7


#安装高版本containerd.io
#查找版本
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
#安装对应版本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

 =================此类是没遇到过的,但是可能会遇见的,做个记录=========================

1.

docker启动报错 :Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disabl...nabled=false)

意思是此linux的内核中的SELinux不支持 overlay2 graph driver,重新编辑docker配置文件:

命令:vi /etc/sysconfig/docker   

原来配置:

改为:

2.

Job for docker.service failed because the control process exited with error code,

修改 /etc/docker/daemon.json文件,注意(中英文),修改为如下内容:

3.

oci runtime error: container_linux.go: starting the process: write pa rent: broken pipe"

linux内核版本太低

 yum update ,更新完再重启linux重启docker重启镜像

注意:ubuntu系统安装软件的命令是 sudo apt-get software  (例如, sudo apt-get install -y docker.io)

         还有一部分linux系统是用yum,例如centos,安装docker命令是,yum install docker 

 

##小菜鸡一枚,如有什么地方错误的,欢迎前来指教,虚心学习~

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值