|Image source: www.lifeofpix.com|
After setting up docker to work in a private environment with an internet proxy it is now time to create a private on premise docker repository (aka docker registry) to store, version and share docker images.
The public repository (as the name says) is public. If you want to maintaine your confidential docker images the public repository is not the place to do that.
In this post i will explain how to install and setup a local docker repository on Red Hat Enterprise Linux. Installation should be also straight forward on other linux distros.
I recommand using the pre build docker images for the docker registry. Setting up docker registry directly on a host typically leads to strange errors like:
Error: Invalid registry endpoint https://0.0.0.0:5000/v1/: Get https://0.0.0.0:5000/v1/_ping: http: error connecting to proxy http://localhost:3128: dial tcp 127.0.0.1:3128: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 0.0.0.0:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/0.0.0.0:5000/ca.crt
To install your private docker registry execute
docker run -p 5000:5000 -d registry
docker then downloads the needed files (image layers) from the public repository and starts the docker registry.
To push images to your private repository add the repository address to the image tag.
So first pull a docker image from the public repository:
Then re-tag it in order to push it in your local private repository
docker tag wasdev
Now you can push it to your private repository
The re-tagging is needed as the docker requires that the respository adress name is part of the image name.