Unable to push to private docker registry inside Kubernetes cluster

5/23/2019

I've created a private registry inside my k8s cluster and exposed it via https and ingress. I build my own images and push them to this registry. I'm able to do docker build, but I can't do "docker login" or "docker push". Here's the error I get:

docker login registry.example.com
Username: admin
Password: 
Error response from daemon: Get https://registry.example.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Here's the pod I'm running it in,

apiVersion: apps/v1
kind: Deployment
metadata:
  name: docker
spec:
  selector:
    matchLabels:
      app: docker
  replicas: 1
  template:
    metadata:
      labels:
        app: docker
    spec:
      containers:
      - name: docker
        image: docker:stable
        command: ["docker"]
        volumeMounts:
          - name: docker-socket
            mountPath: /var/run/docker.sock
      volumes:
        - name: docker-socket
          hostPath:
            path: /var/run/docker.sock
            type: Socket

I am able to push to the official docker registry, my gitlab registry etc. from the same setup.

I am also able to create a container instance of the same setup on my local laptop and push to the k8s registry.

Is there any security setup which prevents me from pushing to my own k8s registry? or is it some network issue?

NOTE I'm able to curl to the k8s registry successfully from inside the pod.

More context: I'm running this in a DigitalOcean Kubernetes cluster.

-- Badri
docker
docker-registry
kubernetes

0 Answers