Using a private docker repository
![]() |
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:
docker pull wasdev
/websphere-liberty
Pulling repository wasdev
/websphere-liberty
1204ea402069: Pulling dependent layers
511136ea3c5a: Download complete
01bf15a18638: Download complete
30541f8f3062: Download complete
...
ed842b4d44db: Download complete
Status: Downloaded newer image
for
wasdev
/websphere-liberty
:latest
Then re-tag it in order to push it in your local private repository
docker tag wasdev
/websphere-liberty
localhost:5000
/websphere-liberty7
Now you can push it to your private repository
docker push localhost:5000
/websphere-liberty
The push refers to a repository [localhost:5000
/websphere-liberty
] (len: 1)
Sending image list
Pushing repository localhost:5000
/websphere-liberty
(1 tags)
Image 511136ea3c5a already pushed, skipping
01bf15a18638: Pushing [==================> ] 76.29 MB
/201
.6 MB 26s
...
1204ea402069: Image successfully pushed
Pushing tag
for
rev [1204ea402069] on
{http:
//localhost
:5000
/v1/repositories/websphere-liberty/tags/latest
}
The re-tagging is needed as the docker requires that the respository adress name is part of the image name.