nolan
1
Hello everyone,
I am having troubles (as in I have been banging my head at the terminal for three hours
troubles) migrating a simple v1 Traefik to its v2 equivalent:
# docker-compose.yml
networks:
default:
external:
name: traefik
services:
reverse-proxy:
command: --api --docker
container_name: traefik
image: traefik:1.7.12-alpine
labels:
- traefik.backend='traefik'
- traefik.frontend.entryPoints=http
- traefik.frontend.rule=Host:traefik.localhost
- traefik.port=8080
ports:
- "80:80"
volumes:
- $PWD/traefik.toml:/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock
version: '3.4'
# traefik.toml
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[docker]
exposedbydefault = true
watch=true
This setup simply creates a container that makes the traefik dashboard accessible from http://traefik.localhost
What would the Traefik v2 equivalent be like ?
Thank you for your comments and reading.
ldez
2
Hello,
the equivalent with Traefik v2:
version: '3.7'
services:
traefik:
image: traefik:v2.1.6
command:
- --providers.docker
- --entrypoints.web.address=:80
- --api
ports:
- 80:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
# Dashboard
traefik.http.routers.traefik.rule: Host(`traefik.localhost`)
traefik.http.routers.traefik.entrypoints: web
traefik.http.routers.traefik.service: api@internal
Recommend read:
nolan
3
Thank you. I had finally made it work with this configuration (no entrypoints though):
# docker-compose.yml
networks:
default:
external:
name: traefik
services:
reverse-proxy:
container_name: traefik
command: --api.insecure=true --providers.docker=true
image: traefik:2.1
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- traefik.http.routers.api.rule=Host(`traefik.localhost`)
- traefik.http.routers.api.service=api@internal
version: '3.4'
I'll be reading you recommendations.
ldez
4
Don't use --api.insecure=true
and api@internal
: as you are using api@internal
you don't need to use the insecure mode.