Traefik proxy to other host
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| version: '3.8'
services: traefik: image: traefik:v2.10 command: - --global.checknewversion=false - --global.sendanonymoususage=false - --accesslog=true - --log.level=debug - --providers.docker - --entrypoints.web.address=:80 - --providers.file.directory=/etc/traefik/dynamic volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock - ./extra.yml:/etc/traefik/dynamic/extra.yml ports: - '80:80'
|
HTTP(S)
File extra.yml
:
1 2 3 4 5 6 7 8 9 10 11 12 13
| http: routers: example_router: rule: PathPrefix(`/`) entryPoints: - web service: example_service
services: example_service: loadBalancer: servers: - url: http://172.16.99.12
|
TCP
File extra.yml
:
1 2 3 4 5 6 7 8 9 10 11 12
| tcp: routers: example_router: entryPoints: - web service: example_service services: example_service: loadBalancer: servers: - address: tcp://1.2.3.4:12345
|