CentOS 7 安装 Docker 并使用阿里云镜像加速--02
1、确认系统版本
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
2、yum 安装 gcc 相关
yum -y install gcc gcc-c++
3、卸载旧的版本
yum -y remove docker docker-common docker-selinux docker-engine
4、安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
5、设置镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6、 更新 yum 软件包索引
yum makecache fast
7、 安装 Docker CE
yum -y install docker-ce
8、启动 Docker并设置开机自启动
systemctl start docker
systemctl enable docker
9、查看版本号
docker --version
10、测试
docker run hello-world
11、添加镜像加速
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://ooadrkaf.mirror.aliyuncs.com"]
}
重启docker
systemctl restart docker
网易开源镜像和中国科学技术大学的开源镜像
vi /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn"]
}
12、卸载 Docker
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker
人生在于拼搏!!!

浙公网安备 33010602011771号