GitHub - tech-shrimp/docker_installer: Docker官方安装包,用来解决因国内网络无法安装使用Docker的问题

1. Docker 安装

1.1 Linux

一键安装命令

sudo curl -fsSL https://get.docker.com| bash -s docker --mirror Aliyun

备用命令(每天自动从官网定时同步)

sudo curl -fsSL https://github.com/tech-shrimp/docker_installer/releases/download/latest/linux.sh| bash -s docker --mirror Aliyun

备用 2(如果 Github 访问不了,可以使用 Gitee 的链接)

sudo curl -fsSL https://gitee.com/tech-shrimp/docker_installer/releases/download/latest/linux.sh| bash -s docker --mirror Aliyun

启动 docker

sudo service docker start

1.2 Windows

任务栏搜索功能,启用”适用于 Linux 的 Windows 子系统” + “虚拟机平台”
|

管理员权限打开命令提示符,安装 wsl2

wsl --set-default-version 2
wsl --update --web-download

等待wsl安装成功 |
下载 Windows 版本安装包,进入此项目的 Release
https://github.com/tech-shrimp/docker_installer/releases

下载Windows版本安装包 | 双击安装即可

可选: 如果想自己指定安装目录,可以使用命令行的方式 参数 —installation-dir=D:\Docker 可以指定安装位置

start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\Docker

1.3 Mac

进入此项目的 Release,下载 Mac 系统的安装包
https://github.com/tech-shrimp/docker_installer/releases ]( https://github.com/tech-shrimp/docker_installer/releases ) [[../../Attachments/4e0ed47102a131b8fa5345fe2b272fef_MD5.png|![|500]]
注意区分 CPU 架构类型 Intel 芯片选择 x86_64, 苹果芯片选择 arm64
下载好双击安装即可

2. Pull 镜像

方案一 转存到阿里云

使用 Github Action 将国外的 Docker 镜像转存到阿里云私有仓库,供国内服务器使用,免费易用

  • 支持 DockerHub, gcr.io, k8s.io, ghcr.io 等任意仓库
  • 支持最大 40GB 的大型镜像
  • 使用阿里云的官方线路,速度快

项目地址: https://github.com/tech-shrimp/docker_image_pusher

方案二 镜像站

现在只有很少的国内镜像站存活
不保证镜像齐全,且用且珍惜
以下三个镜像站背靠较大的开源项目,优先推荐

Linux 配置镜像站
sudo vi /etc/docker/daemon.json

输入下列内容,最后按 ESC,输入 :wq! 保存退出。

{
    "registry-mirrors": [
        "https://docker.m.daocloud.io",
        "https://docker.1panel.live",
        "https://hub.rat.dev"
    ]
}

重启 docker

sudo service docker restart
Windows/Mac 配置镜像站

SettingDocker Engine添加上换源的那一段,如下图 |

方案三 离线镜像

使用Github Action下载docker离线镜像 https://github.com/wukongdaily/DockerTarBuilder

方案四 使用一键脚本

bash -c ”$(curl -sSLf https://xy.ggbond.org/xy/docker_pull.sh)” -s 完整镜像名

方案五 使用 Cloudflare worker 自建镜像加速

https://github.com/cmliu/CF-Workers-docker.io

3. 去哪里找镜像

https://docker.fxxk.dedyn.io/