I have been spending a lot of time getting familiar with Docker. Mostly working with Docker and Kubernetes. If you deploy a Kubernetes cluster you will most likely want to setup your own Docker Registry to pull down custom Docker images from.
I performed the following configuration on CentOS 7 and Docker version 1.8.
STEP 1. Pull down the Docker Registry image file.
docker run -d -p 5000:5000 --restart=always --name registry registry:2
STEP 2. Verify the image is running
STEP 3. Verify the image you are trying to push exists on the local machine
At this point should have the ability to push docker images to the Registry.
However, while trying to configure the Docker Registry I keep receiving the following errors. It turns out by default docker uses HTTPS. Since this is a lab environment I opted to disable the certificate check. I would not recommend this in a production environment.
[root@docker01 node]> docker push docker01.lab.net:5000/node_hello The push refers to a repository [docker01.lab.net:5000/node_hello] (len: 1) unable to ping registry endpoint https://docker01.lab.net:5000/v0/ v2 ping attempt failed with error: Get https://docker01.lab.net:5000/v2/: tls: oversized record received with length 20527 v1 ping attempt failed with error: Get https://docker01.lab.net:5000/v1/_ping: tls: oversized record received with length 20527
To enable a an insecure registry add the line below to your /etc/sysconfig/docker file.
[root@docker01 nfs]> vim /etc/sysconfig/docker INSECURE_REGISTRY='--insecure-registry docker01.lab.net:5000'
restart the docker engine
systemctl restart docker
Now tag your image in the Repository.
[root@docker01 nfs]> docker tag node_hello docker01.lab.net:5000/node_hello
And push the image to the local Repository.
[root@docker01 nfs]> docker push docker01.lab.net:5000/node_hello The push refers to a repository [docker01.lab.net:5000/node_hello] (len: 1) f2f0cae3343d: Pushed f27103454f2e: Pushed e05d047e2eff: Pushed 193fe95a2328: Pushed 53af2affa24d: Pushed 4432b60369bb: Pushed 51dd390dfbe4: Pushed 60e65a8e4030: Pushed 5764f0a31317: Pushed 838c1c5c4f83: Pushed 47d44cb6f252: Pushed latest: digest: sha256:df1a645eb83e9059c6284d9787ca4c9a872f957b8dfa1bbb43fe83f6eeb5c8ee size: 22854 [root@docker01 nfs]>
Reference Documents: https://docs.docker.com/registry/insecure/