Last active
January 31, 2022 17:11
-
-
Save StudioEtrange/c6bb41732063b0151adf5ef592768348 to your computer and use it in GitHub Desktop.
traefik sample for route to an external URL - add a blog.mondomain.com route to http://blog:4000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traefik: | |
image: traefik:v2.1.6 | |
container_name: traefik | |
volumes: | |
- "traefik.enable=true" | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./traefik-conf.yml:/etc/traefik/traefik.yml | |
- ./traefik-services.yml:/etc/traefik/services.yml | |
labels: | |
- "traefik.http.routers.blog.entrypoints=web_main" | |
- "traefik.http.routers.blog.rule=HostRegexp(`{subdomain:blog}.{domain:moncomain.com}`)" | |
- "traefik.http.routers.blog.service=blog@file" | |
networks: | |
- default | |
expose: | |
# web_main entrypoints | |
- 80 | |
ports: | |
- 80:80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE : conf in this file are not cumulative and cancel any option passed to traefik at launch with command in docker compose file | |
api: | |
dashboard: true | |
debug: false | |
insecure: true | |
log: | |
level: "DEBUG" | |
entryPoints: | |
web_main: | |
address: ":80" | |
providers: | |
docker: | |
endpoint: unix:///var/run/docker.sock | |
# If set to false, containers that don't have a traefik.enable=true label will be ignored from the resulting routing configuration | |
exposedByDefault: false | |
file: | |
filename: /etc/traefik/services.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http: | |
services: | |
blog: | |
loadBalancer: | |
servers: | |
- url: "http://blog:4000/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment