Joxit / docker-registry-ui

The simplest and most complete UI for your private registry
https://joxit.dev/docker-registry-ui/
GNU Affero General Public License v3.0
2.55k stars 322 forks source link

[HELP] Can't get it to work using simple configuration #398

Open Lolozendev opened 1 month ago

Lolozendev commented 1 month ago

Hi, I'm trying to setup docker register ui but always fall on CORS errors , and I can't seem to find why.

I have this docker compose config:

services:
  registry:
    ports:
      - 5000:443
    restart: always
    container_name: my-registry
    image: registry:latest
    volumes:
      - ./registry:/var/lib/registry
      - ./certs:/certs
      - ./auth:/auth
      - ./registry_config/simple.yml:/etc/docker/registry/config.yml
  registry-ui:
    restart: always
    ports:
      - 80:80
    image: joxit/docker-registry-ui:main
    environment:
      - SINGLE_REGISTRY=true
      - REGISTRY_TITLE=My Docker Registry UI
      - DELETE_IMAGES=true
      - REGISTRY_URL=https://192.168.0.10:5000
      - SHOW_CONTENT_DIGEST=true
      - REGISTRY_SECURED=true
    container_name: my-registry-ui
    depends_on:
      - registry
networks: {}

I'm using self signed certificate for my registry. And here is my registry config

version: 0.1
log:
  fields:
    service: registry
storage:
  delete:
    enabled: true
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
http:
  addr: :443
  tls:
    certificate: /certs/localhost.crt
    key: /certs/localhost.key
  headers:
    X-Content-Type-Options: [nosniff]
    Access-Control-Allow-Origin: ['https://192.168.0.10:5000']
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
    Access-Control-Max-Age: [1728000]
    Access-Control-Allow-Credentials: [true]
    Access-Control-Expose-Headers: ['Docker-Content-Digest']
auth:
  htpasswd:
    realm: basic-realm
    path: /auth/htpasswd

When I try to connect to my registry through command line it works:

curl --user 'Admin:SuperPassword' -Lk https://192.168.0.10:5000/v2/_catalog {"repositories":["testimage"]}

But when going on http://192.168.0.10 I get the error The 'Access-Control-Allow-Credentials' header in the response is missing and must be set to 'true' when the request's credentials mode is on. Origin 'https://192.168.0.10:5000' is therefore not allowed access.

Can you help me understand what I'm doing wrong please ?

Joxit commented 1 week ago

Is this happening on an OPTIONS request ?