docker-compose.yml
version: '2'
services:
consul:
extends:
file: consul.yml
service: consul
traefik:
extends:
file: traefik.yml
service: traefik
consul.yml
version: "2"
services:
consul:
image: consul:1.9.4
ports:
- 8300:8300
- 8500:8500
- 8600:8600
command: consul agent -dev -ui -client 0.0.0.0
labels:
- traefik.enable=true
- "traefik.http.routers.my-router.rule=Host(`localhost`) && PathPrefix(`/services/`)"
- "traefik.http.middlewares.test-stripprefixregex.stripprefixregex.regex=/services/[a-z]+/"
- "traefik.http.routers.my-router.middlewares=test-stripprefixregex"
trafik.yml
version: "2"
services:
traefik:
image: traefik:v2.4
ports:
- 80:80
- 28080:8080
volumes:
- ./traefik/traefik.yml:/etc/traefik/traefik.yml
- /var/run/docker.sock:/var/run/docker.sock
./traefik/traefik.yml
log:
level: DEBUG
api:
insecure: true
providers:
docker:
exposedByDefault: false
consulCatalog:
exposedByDefault: true
prefix: traefik
defaultRule: "Host(`localhost`) && PathPrefix(`/services/{{ normalize .Name }}`)"
endpoint:
address: "consul:8500"
any one can help me resolve this?
any one can help me resolve this?