-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<a href="https://dockermirror.com" target="_blank" rel="noopener"><img src="https://github.com/docker-mirrors/website/raw/main/public/docker_mirrors_logo_and_text.png?sanitize=true" alt="Docker Mirror Logo" style="max-width: 100%;" /></a> | ||
|
||
## Docker Mirror | ||
|
||
从去年开始. [hub.docker.com](https://hub.docker.com/) 在国内的访问速度极慢. 当时大家主要还是依赖国内的一些镜像源: 如中科院或alipapa etc. 但是今年逐渐所有的国内镜像站也逐渐关闭. 在墙内的小伙伴想要拉取镜像变成了很困难的事情。 | ||
|
||
现在可以使用 [docker-mirror](https://dockermirror.com) 来加速你的镜像服务. 仅需根据你的使用情况简单几步配置即可完成配置. 此外还提供两个搜索网站来帮助检索镜像. | ||
|
||
- [docker-mirror](https://dockermirror.com) | ||
- [hub.dockermirror](https://hub.dockermirror.com/) | ||
|
||
## 视频教程 | ||
|
||
注: 视频中使用的是 orb. 基本操作和直接使用 docker 相同. 具体细节可以查看下面的配置方法. | ||
|
||
<a href="https://dockermirror.com" target="_blank" rel="noopener"><video style="max-width: 100%;" controls><source src="https://github.com/docker-mirrors/website/raw/main/public/docker-mirrors-example.mp4?sanitize=true"></source></video></a> | ||
|
||
## 配置方法 | ||
|
||
### 使用 Docker File | ||
|
||
编辑 `/etc/docker/daemon.json`,并添加 [registry-mirror](https://docs.docker.com/docker-hub/mirror/#configure-the-docker-daemon) 键和值,使更改始终生效。 | ||
|
||
```json | ||
{ | ||
"registry-mirrors": ["https://registry.dockermirror.com"] | ||
} | ||
``` | ||
|
||
更多细节, 见 [docker 文档](https://docs.docker.com/docker-hub/mirror/#configure-the-docker-daemon). | ||
|
||
如果你正在使用 orbstack. 你也可以直接在 `~/.orbstack/config/docker.json` 中编辑配置,然后用 `orb restart docker` 重启引擎。 | ||
|
||
```json | ||
{ | ||
"hosts": ["https://registry.dockermirror.com"] | ||
} | ||
``` | ||
|
||
更多 orb 细节, 见 [orb 文档](https://docs.orbstack.dev/docker/#engine-config). | ||
|
||
### 命令行使用配置 | ||
|
||
在手动拉取 dockerd 镜像时,通过 --registry-mirror 选项来使更改 registry。 | ||
|
||
```bash | ||
$ docker pull ubuntu --registry-mirror=https://registry.dockermirror.com | ||
``` | ||
|
||
更多细节, 见 [docker pull 文档](https://docs.docker.com/reference/cli/docker/image/pull/?highlight=docker&highlight=pull). | ||
|
||
### 直接使用 Registry | ||
|
||
手动指定要从注册表中提取的路径。注册表路径类似于 URL,但不包含协议指定符 (https://)。 | ||
|
||
```bash | ||
$ docker pull registry.dockermirror.com/ubuntu | ||
``` | ||
|
||
更多细节, 见 [docker pull-from-a-different-registry 文档](https://docs.docker.com/reference/cli/docker/image/pull/?highlight=docker&highlight=pull#pull-from-a-different-registry). | ||
|
||
## 相关链接 | ||
|
||
- [github](https://github.com/docker-mirrors) | ||
- [website-github](https://github.com/docker-mirrors/website) | ||
- [website](https://dockermirror.com) | ||
- [hub.dockermirror](https://hub.dockermirror.com) |