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.52k stars 322 forks source link

Host ui and registry on traefik subpath / pathprefix #397

Open MLB-BIOMETRIC opened 2 weeks ago

MLB-BIOMETRIC commented 2 weeks ago

Hi!

I am having issues with hosting my the UI and the registry on subpaths using traefik. Does anyone know how to successfully do this?

The problem im facing is regarding the requests to the .css and .js files. With the following config i just get 404 not found when i visit /docker-ui

Below is my docker-compose:

services:

  # Traefik - reverse proxy

  traefik:
    image: traefik:v2.10.4
    command:
      - --api.dashboard=true
      - --api.insecure=true
      - --providers.docker
      - --log.level=INFO
      - --providers.file.directory=/certificates
      - --entryPoints.web.address=:80
      - --entryPoints.websecure.address=:443
      - --entrypoints.web.forwardedHeaders.insecure=true
      - --entrypoints.websecure.forwardedHeaders.insecure=true
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - //var/run/docker.sock:/var/run/docker.sock
      - D:\all_data\traefik\certificates:/certificates
    networks:
      - build03

  # Docker Image registry

  registry-ui:
    image: joxit/docker-registry-ui:main
    restart: always
    ports:
      - 5557:80
    dns:
      - "192.168.96.22"
      - "192.168.77.21"
    environment:
      - SINGLE_REGISTRY=true
      - REGISTRY_TITLE=Docker Registry UI
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - NGINX_PROXY_PASS_URL=http://registry-server:5000
      - SHOW_CATALOG_NB_TAGS=true
      - CATALOG_MIN_BRANCHES=1
      - CATALOG_MAX_BRANCHES=1
      - TAGLIST_PAGE_SIZE=100
      - REGISTRY_SECURED=false
      - CATALOG_ELEMENTS_LIMIT=1000
    labels:
      - "traefik.http.routers.registry-ui.rule=PathPrefix(`/docker-ui`)"
      - "traefik.http.routers.registry-ui.entrypoints=websecure"
      - "traefik.http.routers.registry-ui.tls=true"
    networks:
      - build03

  registry-server:
    image: registry:2.8.2
    restart: always
    environment:
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://registry.example.com]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
    volumes:
      - D:\all_data\docker-registry\data:/var/lib/registry
    labels:
      - "traefik.http.routers.registry-server.rule=PathPrefix(`/docker-server`)"
      - "traefik.http.routers.registry-server.entrypoints=websecure"
      - "traefik.http.routers.registry-server.tls=true"
    ports:
      - 5000:5000
    dns:
      - "192.168.96.22"
      - "192.168.77.21"
    networks:
      - build03

networks:
  build03:
    driver: bridge
Joxit commented 14 hours ago

Hi, you must force the trailling slash at the end of your path /docker-ui/