安装Docker
更新本地yum仓库
安装epel扩展更新源
bash
sudo yum install -y vim wget epel-release
更新yum仓库
bash
sudo yum update -y
删除旧版本docker
bash
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装yum管理工具并配置docker镜像源
安装yum管理工具
bash
sudo yum install -y yum-utils
配置docker阿里镜像源
bash
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker
bash
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
启动docker并检验安装
bash
sudo systemctl start docker && docker run hello-world
docker一键安装脚本
bash
sudo yum install -y vim wget epel-release && yum update -y \
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine && \
yum install -y yum-utils && yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo \
yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin \
systemctl start docker && docker run hello-world