2019-12-05 CentOS7(Ubuntu18.04)安
2019-12-05 本文已影响0人
柒李香

CentOS7
1、卸载旧版本
yum remove docker docker-common docker-selinux docker-engine
2、更新数据源
yum update
3、安装所需依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
4、新增数据源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
5、更新并安装 Docker CE
yum update && yum install -y docker-ce
6、查看版本
docker --version
7、加入开机启动
systemctl start docker
systemctl enable docker
Ubuntu18.04
1、卸载旧版本
apt-get remove docker docker-engine docker.io containerd runc
2、更新数据源
apt-get update
3、安装所需依赖
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
4、安装 GPG 证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
5、新增数据源
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
6、更新并安装 Docker CE
apt-get update && apt-get install -y docker-ce
7、查看版本
docker --version
8、加入开机启动
systemctl start docker
systemctl enable docker
配置docker镜像源防止拉取镜像超时
安装Docker-Compose
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# 验证安装是否成功
docker-compose version
显示类似于图片中信息即为成功
