centos7系统安装最新版本Docker

记得卸载老版本Docker,如新环境则忽略该提示

设置yum源改为阿里镜像

修改yum配置文件

vim /etc/yum.repos.d/CentOS-Base.repo

编辑内容

注释掉所有 mirrorlist 行
取消所有的baseurl的注释,并将所有的 mirrorlist.centos.org 改为 mirrors.aliyun.com
内容如下:

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

安装yum工具

sudo yum install -y yum-utils

设置Docker国内镜像

$ sudo yum-config-manager  --add-repo  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装Docker

sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

验证Docker版本

docker -v

启动docker

docker启动命令

systemctl start docker
systemctl stop docker
systemctl status docker

docker镜像配置

登录阿里云账号(https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
根据操作文档配置镜像文件 /etc/docker/daemon.json

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容