Ubuntu等系统安装
curl -fsSL https://get.docker.com -o get-docker.sh
sudo DOWNLOAD_URL=https://mirrors.ustc.edu.cn/docker-ce sh get-docker.sh
CentOS安装
1. 卸载之前版本(如果有)
yum -y remove docker-ce \
containerd.io \
docker-ce-cli \
docker-compose-plugin
2. 安装yum-utils软件包(提供yum-config-manager实用程序),并设置稳定的存储库
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
官方地址
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3. 安装Docker Engine
yum -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4. 启动Docker
systemctl start docker
5. 开机自启
systemctl enable docker
6. 配置镜像加速源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://dockerproxy.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
7. 通过运行hello-world映像来验证Docker引擎是否安装正确
docker run hello-world
评论区