安装依赖
# 配置阿里云源# 备份cp /etc/yum.repos.d/CentOS-Base.repo{,.bak'_'`date +%Y%m%d_%H%M%S`}# 下载wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo# 生效测试yum clean allyum makecache# 配置epel源yum install -y epel-release# 备份(如有配置其他epel源)cp /etc/yum.repos.d/epel.rep{,.bak'_'`date +%Y%m%d_%H%M%S`}cp /etc/yum.repos.d/epel-testing.repo{,.bak'_'`date +%Y%m%d_%H%M%S`}# 下载新repo到/etc/yum.repos.d/wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
卸载旧依赖
yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-selinux \docker-engine-selinux \docker-engine
安装Docker CE
# 设置存储库yum install -y yum-utils \device-mapper-persistent-data \lvm2yum-config-manager \--add-repo \http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoyum-config-manager --enable docker-ce-edge# yum-config-manager --enable docker-ce-test# yum-config-manager --disable docker-ce-edgeyum makecache fastyum install -y docker-ce # 安装指定版本 # yum install -y docker-ce-18.06.1.ce-3.el7
Docker阿里云镜像:
创建用户组
groupadd dockerusermod -aG docker rootusermod -aG docker www-data
设置启动项
systemctl enable dockerservice docker start
全自动脚本: