一、打开官网
二、安装步骤
1.卸载旧的docker
$ sudo yum remove docker ???????? docker-client ???????? docker-client-latest ???????? docker-common ???????? docker-latest ???????? docker-latest-logrotate ???????? docker-logrotate ???????? docker-selinux ???????? docker-engine-selinux ???????? docker-engine
x
10
1
$ sudo yum remove docker \
2
???????? docker-client \
3
???????? docker-client-latest \
4
???????? docker-common \
5
???????? docker-latest \
6
???????? docker-latest-logrotate \
7
???????? docker-logrotate \
8
???????? docker-selinux \
9
???????? docker-engine-selinux \
10
???????? docker-engine
2.安装相关依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
x
1
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
1
$ sudo yum-config-manager \
2
--add-repo \
3
https://download.docker.com/linux/centos/docker-ce.repo
3.更新yum缓存
sudo yum makecache fast
sudo yum -y install docker-ce
x
1
sudo yum makecache fast
2
3
sudo yum -y install docker-ce
查看可安装的版本
yum list docker-ce --showduplicates | sort -r
1
yum list docker-ce --showduplicates | sort -r
4.启动docker
$ sudo systemctl start docker
1
$ sudo systemctl start docker
5.验证docker
docker -v
1
docker -v
6.设置开机启动
systemctl enable docker
1
systemctl enable docker
7.配置阿里云镜像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF‘
{
"registry-mirrors": ["https://2f1vlmvh.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
1
sudo mkdir -p /etc/docker
2
sudo tee /etc/docker/daemon.json <<-‘EOF‘
3
{
4
"registry-mirrors": ["https://2f1vlmvh.mirror.aliyuncs.com"]
5
}
6
EOF
7
sudo systemctl daemon-reload
8
sudo systemctl restart docker