A few days ago, all major mirror sites went down, making it a problem to pull Docker
images.
At first, I didn't care; when it was down, I just used a proxy to pull, but even with a proxy, I couldn't pull normally when using Docker
locally.
So I started looking for solutions, and after some research, I found the following options:
- Build using
Cloudflare Workers
, which requires adomain
-> Original post - Self-host
Nexus 3
, which requires a foreignVPS
, preferably with4GB RAM or more
, and also requires adomain
-> Original post - Use
Github Action
to transferDockerHub
images to Alibaba Cloud's private repository, which only requires aGithub
account -> Original post - Use
Nginx reverse proxy
, which is more suitable for those who already have a server -> Original post - Other options include finding existing image sources, but these are generally not very stable, so I didn't consider this.
I used the first option, which is relatively simple. The tutorial in the original post is not very detailed, so I'll elaborate here.
- Go to the Cloudflare homepage, create a new Worker in the left
Workers & Pages
section, and save theAccount ID
on the right.
Give the Worker
a name, click Save
, and then click Finish
.
When this page appears, you can proceed to the next step.
Fork
this repository andClone
it to your local machine.
As usual, install the dependencies first.
pnpm i
Then rename wrangler.toml.sample
to wrangler.toml
.
cp wrangler.toml.sample wrangler.toml
Edit the wrangler.toml
file, modifying name
and account_id
.
name = "name of the workers"
account_id = "fill in the Account ID you copied above"
main = "src/index.ts"
workers_dev = true
compatibility_date = "2024-06-08"
kv_namespaces = [
{ binding = "HAMMAL_CACHE", id = "your kv id" }
]
- Get the
kv ID
by executing the command below, which will output the id. Modify theid
in the configuration.
npx wrangler kv:namespace create hammal_cache
- Then deploy by executing:
pnpm run deploy
Warning
You will be prompted that you are about to publish a Workers service, which was last published through the Cloudflare Dashboard. Edits made through the Cloudflare Dashboard will be overwritten by your local code and configuration.

Enter y
, and it will normally open a browser for you to authorize. Just authorize; I didn't get a prompt here because I had already deployed it before.

- Add a domain to the newly deployed
Workers
.
Wait for the domain to take effect, and you can use it normally. Generally, you just need to modify /etc/docker/daemon.json
on the server to configure the source address you just set up.
"registry-mirrors": [
"https://hammal.example.com"
]
I am using Orbstack on Mac
, so I need to configure it directly in the software.

This article was synchronized and updated to xLog by Mix Space. The original link is https://remrin.dev/posts/dev/docker