centos 安装docker

perfect start 9月前 ⋅ 1704 阅读

安装文档

docker安装文档

安装可能遇到的问题

Last metadata expiration check: 0:08:21 ago on Tue 29 Oct 2019 02:02:21 PM CST.
Error: 
 Problem: package docker-ce-3:19.03.4-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.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
  - package containerd.io-1.2.6-3.2.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages

原因: 最新版本的docker需要 1.2.2-3以上的containerd.io,可以选择安装低版本的docker,也可以升级 containerd.io,

  • 查询可用的docker
yum list docker-ce --showduplicates | sort -r
# 选择安装

sudo yum install <FULLY-QUALIFIED-PACKAGE-NAME>
  • 升级containerd.io
wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

yum -y install containerd.io-1.2.6-3.3.el7.x86_64.rpm
#安装最新的docker
yum install docker-ce

docker命令

#启动
sudo systemctl start docker

#运行镜像hello-world

sudo docker run hello-world

卸载docker

#卸载
sudo yum remove docker-ce
# 删除docker相关容器镜像
sudo rm -rf /var/lib/docker

全部评论: 0

    我有话说: