[Docker]ECS服务器下Docker运维(不定时更新)

老谢的自留地 2020-06-13

安装:

------------------------------------------------------------------------------------------------------------------------------------------

在ECS上安装Docker,需要关注两个问题:

1.ECS的系统版本,内核版本

2.containerd.io及Docker版本

查询内核

我这里以 CentOS 8.0 64位,内核可以用 #uname -a查询

[Docker]ECS服务器下Docker运维(不定时更新)

一般来说安装Docker需要内核高于3.8。

如果低于则需要更新内核,更新内核可在ECS官方文档和论坛找到方法,因为CentOS 8 一般不用升级

添加yum源

由于ECS的CentOS 的yum没有repo是对应Docker的源,所以这里需要添加源

vim /etc/yum.repos.d/docker.repo

这里给/etc/yum.repos.d/目录下添加repo,内容如下:

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=0 
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://download.docker.com/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

安装Docker

yum install docker-ce -y

但是安装这里可能会出现问题,这是因为你的containerd.io版本过低,不能直接安装最新版docker-ce

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

两种解决方法:(1)直接安装低版本Docker,建议这个

     (2)更新containerd.io

因为我查找containerd.io,发现其安装版本只有一个,可能ECS对应的源,我没有添加原来的源(懒得弄了)

干脆直接安装低版本Docker,查看yum下docker-ce版本

yum list docker-ce --showduplicates | sort -r
yum -y install  docker-ce-18.06.0.ce-3.el7

这里直接选用18.06.0.ce-3.el7以下版本即可,安装成功

  

相关推荐