I have a Kubernetes cluster with a Master node and a worker node and i decided to create a private docker registry in order to push the images and distribute them to the worker nodes when it is needed.
I made the following steps:
- Created a docker-compose file :
version: '3.0'
services:
registry:
container_name: docker-registry
restart: always
image: registry:2
ports:
- 5000:5000
volumes:
- docker-registry-data:/var/lib/registry
volumes:
docker-registry-data: {}
- I ran the docker-compose.yaml file and when i saw the docker-compose processes i had the following output:
docker-registry /entrypoint.sh /etc/docker ... Up 0.0.0.0:5000->5000/tcp,:::5000->5000/tcp
- Then i created a simple docker image and pushed it into my docker registry. When i check my images i can see it :
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost:5000/myimage v2 0c68aa61e008 18 minutes ago 124MB
- In /etc/docker/daemon.json of my worker node i entered :
"insecure-registries": ["master_ip:5000"]
**In insecure-registries above i entered the ip of my master node because there i created the docker registry.
After this configuration i supposed that when i try to run a pod in my cluster by using an image which is located in my docker registry it should work. But the status of my created pod is ImagePullBackOff and when i see the logs of the pod i have the following output :
Failed to pull image "<master_ip>:5000/myimage:v2": rpc error: code = Unknown desc = failed to pull and unpack image "<master_ip>:5000/myimage:v2": failed to resolve reference "<master_ip>:5000/myimage:v2": failed to do request: Head https://<master_ip>:5000/v2/myimage/manifests/v1: http: server gave HTTP response to HTTPS client