Lainbo

Lainbo's Blog

If you’re nothing without the suit, then you shouldn't have it.
github
email
follow

How to Build Your Own Docker Hub Image

Since mid-May 2023, a mysterious force has rendered the Docker container platform https://hub.docker.com inaccessible.

More than a year has passed, and as of now (June 9, 2024), Nanjing University, University of Science and Technology of China, and Shanghai Jiao Tong University have clearly stopped their Docker image caching services. NetEase has already shut down, Tencent and Microsoft are reportedly available on the intranet, Alibaba can access subdomains after logging in, and Baidu seems to be down as well; dockerproxy has been blocked.

So, let's build one ourselves! (smiley face)

The two methods introduced in this article are not completely zero-threshold; Method One requires you to have your own domain name, and Method Two requires you to have your own overseas server.

Method One: Using Cloudflare Worker#

The registration method for Cloudflare will not be elaborated here; you can register with just an email. This method requires you to have your own domain name.

  1. Click on "Workers and Pages" in the menu bar, then click "Create Worker"
    image

  2. Name your Worker, for example, docker-proxy, click "Save," then click "Done."

    At this point, it should prompt you, "Congratulations! Your Worker has been deployed to the following region: Global"

  3. Click "Edit Code" on the right, delete the existing code on the left, and paste the following code. You need to change the workers_url at the top to the domain you want to deploy.

    • Code content
  4. Click "Deploy" in the upper right corner.

  5. Since the domain name provided by the Worker is subject to DNS pollution, we need to return to the Worker, click in order as shown, enter the domain name you just filled in the code, and submit the changes. If your domain is hosted on Cloudflare, it should take effect in about 2 minutes; if hosted on other providers, you will need to CNAME it yourself.
    image

  6. At this point, we can enter the following command on the server to take effect:


Method Two: Using an Overseas Server to Build Your Own#

Lazy Script#

Or if you want to do it step by step#

  1. Create a docker-compose.yml file with the following content:

  2. Run it with docker-compose up -d.


Whether using the lazy script or creating a docker-compose file, both will utilize Docker to start this self-built service on port 17951. Next, you need to:

  1. Reverse proxy the above-mentioned port 17951, assign a domain name, add an HTTPS certificate, and add a DNS record.

  2. At this point, we can enter the following command on the domestic server to take effect:

Method Three: Using huecker#

This is a ready-made mirror set up by an author.

And some other overseas mirrors worth trying:

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.