This project utilizes GitHub Actions to automatically transfer DockerHub images to the GitHub Container Registry (GHCR.IO). This prevents issues with image access due to blocking or retraction, ensuring the safety and reliability of your image resources. You can leverage GitHub's free 2000 minutes of private repository runtime per month or use a public repository for unlimited runtime. Additionally, using the Nanjing University Open Source Mirror accelerates the pulling of GHCR.IO images within China.
Please do not use Fork! Forked repositories have limitations on GitHub Actions runtime. Instead, import the project using Git:
- Click this link to go to GitHub's import page: GitHub Import Page
- In the "Your old repository's clone URL" field, enter:
https://codeberg.org/fossandroid/dockerhub2ghcr.git - Follow the prompts to complete the project import.
-
Go to your GitHub repository and click the "Actions" tab at the top of the page.
-
In the left sidebar, find the "DockerHub image copied to GHCR.IO" workflow and click it. (Note: "DockerHub image copied to GHCR.IO" translates to "Copy DockerHub Image to GHCR.IO")
-
Click the "Run workflow" button on the upper right corner. This will display a form to input parameters.
-
Fill in the following parameters in the popup:
- dockerhub_image: The DockerHub image name (default is
nginx), e.g.,alpineorpython. - tag: The image tag, default is
latest. You can specify a version like1.0. - ghcr_image: The desired name of the image you want to push to GHCR.IO, such as
myimage.
- dockerhub_image: The DockerHub image name (default is
-
After filling in the parameters, click the "Run workflow" button. GitHub Actions will automatically run, syncing your specified DockerHub image to GHCR.IO.
- dockerhub_image:
nginx - tag:
latest - ghcr_image:
my-nginx
Upon completion, GitHub Actions will automatically pull the DockerHub image and push it to GHCR.IO.
To speed up image downloads in China, you can use Nanjing University's Open Source Mirror. Simply replace ghcr.io with ghcr.nju.edu.cn when pulling images:
docker pull ghcr.nju.edu.cn/<your-username>/<your-image>:<tag>This significantly improves the speed of pulling images from GHCR.IO within China.
- Prevents Image Retraction or Blocking: Syncing to a private GHCR.IO repository ensures continued access even if the original image is retracted or blocked.
- Free Use of GitHub Container Service: 2000 free minutes of private repository runtime per month, or unlimited runtime for public repositories.
- Accelerated Domestic Mirror: Using Nanjing University's mirror makes pulling images from GHCR.IO faster and more stable within China.