docker安装使用镜像源

Posted on Aug 8, 2025

Docker 提供了一个自动配置与安装的脚本,支持 Debian、RHEL、SUSE 系列及衍生系统的安装。请注意,Docker 官方不建议在生产环境使用此脚本安装 Docker CE。

前提假设: 用户为root用户,或者具有sudo权限的用户。 具有wget或curl命令的Linux系统。

export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
# 如您使用 curl
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh
# 如您使用 wget
wget -O- https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh

当然,因为某些原因,raw.githubusercontent.com可能无法访问,所以我们可以使用国内ghs镜像站点,如"ghproxy.com",所以我们可以使用下面的命令来安装docker,请优先确定镜像加速可以用

export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
# 如您使用 curl
curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh
# 如您使用 wget
wget -O- https://ghproxy.com/https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh