This is a creation in
Article, where the information may have evolved or changed.
Make your own Docker registry image
- The current
registry separate project has been abandoned and replaced by distribution, which, to be sure, is the project registry , but above registry , its goal is to become a tool for content distribution, but image only a form of content.
- Directly through
distribution the Dockerfile , build the image, we found that the construction of the image is very large, about 380 m, and the official registry mirror size of only 30 m, this is not your build process has a problem, because the official distribution/image
It's more than 300 m large.
- Through
distribution the study Dockerfile , it will be found that the mirror in the production process, the base image is from golang alpine the beginning, so the entire base image is very large, that is packaged in the registry image
There golang is a compilation environment
Ways to reduce mirroring
- Modified
distribution Dockerfile files, in the final cleanup phase, the go compilation environment is removed from the image, which will greatly reduce the size of the mirror
- Use
registry the official build image of the project Distribution-library-image to generate the image
The first step ./update.sh tag is to update the binaries by going registry back to distribution by specifying tag or branch pulling up the latest distribution code, then using distribution the Dockerfile build image in, and then starting the container based on that image
, copy the files from this container registry config-example.yml to the registry directory in this project, and then perform the
DockerfileTo perform a build image
- In accordance with the above principle, if you want to build your own
fork modified registry project to generate registry image, only need to distribution-library-image the script of the update.sh official github address, to their own address can be