我将traefik与 docker 后端一起使用。这是我开始 traefik 的方式:
$ cat docker-compose.yml
version: '2'
networks:
default:
external:
name: proxy
services:
traefik:
image: traefik
command: --web --docker --docker.domain=docker --logLevel=WARNING
container_name: traefik
ports:
- "80:80"
- "8080:8080"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
labels:
- "traefik.frontend.rule=Host:dashboard.docker"
- "traefik.port=8080"
我想要 2 个容器,一个是docker registry,第二个是registry 的 UI。我希望所有 HTTP 请求registry.docker/v2/*
都通过注册表容器,但任何其他请求(registry.docker/
、、registry.docker/repositories/20
...)都通过 UI 容器。
这是我尝试过的:
$ cat docker-compose.yml
version: '2'
networks:
default:
external:
name: proxy
services:
registry:
image: registry:2
container_name: registry
environment:
- REGISTRY_STORAGE_DELETE_ENABLED=true
labels:
- traefik.frontend.rule=Host:registry.docker, PathPrefix:/v2
- traefik.frontend.port=5000
registry-ui:
image: konradkleine/docker-registry-frontend:v2
container_name: registry-ui
environment:
- ENV_DOCKER_REGISTRY_HOST=registry.docker
- ENV_DOCKER_REGISTRY_PORT=80
- ENV_DOCKER_REGISTRY_USE_SSL=false
labels:
- traefik.frontend.rule=Host:registry.docker
但是所有请求都通过registry
容器。我应该改变什么?