ubuntu20.4 安装步骤:
安装命令如下:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
也可以使用国内 daocloud 一键安装命令:
curl -sSL https://get.daocloud.io/docker | sh
centos8 安装步骤:
1、yum包更新到最新
yum update
2、安装基础包
yum install -y yum-utils device-mapper-persistent-data lvm2
3、添加docker-ce源
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
4、如果报Problem: package docker-ce-3:19.03.4-3.el7.x86_64 requires containerd.io >= 1.2.2-3 那就先装新版的 containerd.io的错误,先安装containerd.io
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
5、如果安装过程中与podman冲突,移除podman即可
yum remove podman
6、启动docker,设置开机自启动
systemctl start docker
systemctl enable docker
7、添加阿里云加速器
sudo mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json
添加属性:
{
"registry-mirrors": ["https://cenq021s.mirror.aliyuncs.com"]
}
sudo systemctl daemon-reload
sudo systemctl restart docker