Skip to content

[Bug] Docker Registry Example with non-root path results in Default Backend 404 #4027

Closed
@gaby

Description

@gaby

NGINX Ingress controller version: Latest

What happened:
When deploying the docker-registry using the example provided on this repository and using a non-root path docker is unable to push images.

What you expected to happen:
Be able to push images to non-root paths

How to reproduce it (as minimally and precisely as possible):

I just followed the docker-registry example and added a non-root path using REGISTRY_HTTP_PREFIX in the deployment.

Anything else we need to know:

Deployment.yml

apiVersion: v1
kind: Namespace
metadata:
  name: docker-registry

---

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: docker-registry
  namespace: docker-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: docker-registry
  template:
    metadata:
      labels:
        app: docker-registry
    spec:
      containers:
        - name: docker-registry
          image: registry:2.6.2
          env:
            - name: REGISTRY_HTTP_ADDR
              value: ":5000"
            - name: REGISTRY_HTTP_PREFIX
              value: "/registry/"
            - name: REGISTRY_HTTP_HOST
              value: "<mydomain>"
            - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
              value: "/var/lib/registry"
          ports:
          - name: http
            containerPort: 5000
          volumeMounts:
          - name: image-store
            mountPath: "/var/lib/registry"
      volumes:
        - name: image-store
          emptyDir: {}

---

kind: Service
apiVersion: v1
metadata:
  name: docker-registry
  namespace: docker-registry
  labels:
    app: docker-registry
spec:
  selector:
    app: docker-registry
  ports:
  - name: http
    port: 5000
    targetPort: 5000

Ingress Rule

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/rewrite-target: "/registry/"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    kubernetes.io/tls-acme: 'true'
  name: docker-registry
  namespace: docker-registry
spec:
  tls:
  - hosts:
    - <mydomain>
    secretName: registry-tls
  rules:
  - host: <mydomain>
    http:
      paths:
      - backend:
          serviceName: docker-registry
          servicePort: 5000
        path: /registry/ 

Note:

Visiting https://mydomain.com/registry/v2/_catalog from a browser works fine and I get a respond back from the registry.

Ex.

docker pull alpine:latest
docker tag alpine:latest mydomain.com/registry/alpine:latest
docker push mydomain.com/registry/alpine:latest

When doing a push I get default backend 404.

I'm not sure if this is an issue with Docker, Registry, NGINX Ingress, or what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions