[HELP] Can't get it to work using simple configuration
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 ?
Is this happening on an OPTIONS request ?
I get this
Your configuration looks a bit weird, I see REGISTRY_URL=https://192.168.0.10:5000 for the ui and Access-Control-Allow-Origin: ['https://192.168.0.10:5000'] for the registry server.
They should not be the same URL, REGISTRY_URL should be your registry URL (this is ok) but Access-Control-Allow-Origin should be your UI URL (this is not ok)
If your UI is on http://192.168.1.155 as shown in your screenshot, having a OPTIONS requests on it should not happen since the UI should be communicating with the registry and the path should have at least /v2/.