Hi!
I am running Traefik in a docker container with docker compose. In an earlier thread someone helped and told me that it is not possible to mix a file configuration with a configuration in docker compose. So I decided to configure all attributes - static as well as dynamic - in the docker compose file. The file looks like this (I cut the other container configurations):
version: "3.3"
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
ports:
- "x.x.x.x:8080:8080"
- "80:80"
- "443:443"
networks:
- "proxy"
environment:
- HTTPREQ_ENDPOINT=http://x.x.x.x:xxxx
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--global.checkNewVersion=true"
- "--api"
- "--log.filePath=/logs/traefik.log"
- "--log.level=INFO"
- "--accessLog.filePath=/logs/access.log"
- "--accessLog.bufferingSize=100"
- "--entryPoints.api.address=:8080"
- "--entryPoints.web.address=:80"
- "--entryPoints.web.http.redirections.entryPoint.to=websecure"
- "--entryPoints.web.http.redirections.entryPoint.scheme=https"
- "--entryPoints.websecure.address=:443"
- "--certificatesResolvers.letsencrypt.acme.email=ssladmin@xxxxxxxxx.com"
- "--certificatesResolvers.letsencrypt.acme.storage=acme/acme.json"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.provider=httpreq"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.delayBeforeCheck=7"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/home/traefik/acme:/acme"
- "/home/traefik/logs:/logs"
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`x.x.x.x`)"
- "traefik.http.routers.api.entryPoints=api"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=api-auth"
- "traefik.http.middlewares.api-auth.basicauth.users=admin:xxxxxxxxxxxxxxx"
- "traefik.http.services.freiberg-oh.loadBalancer.server.url=http://x.x.x.x:8080/"
- "traefik.http.routers.freiberg.rule=Host(`freiberg.xxxxxxxxx.de`)"
- "traefik.http.routers.freiberg.service=freiberg-oh"
- "traefik.http.routers.freiberg.entryPoints=websecure"
- "traefik.http.routers.freiberg.tls"
- "traefik.http.routers.freiberg.tls.domains[0].main=freiberg.xxxxxxxx.de"
- "traefik.http.routers.freiberg.tls.domains[0].sans=*.freiberg.xxxxxxxxx.de"
- "traefik.http.routers.freiberg.tls.certresolver=letsencrypt"
restart: always
Everything (the other containers) is running smoothly so far but the external configuration for "freiberg". What I want to achieve is to point the domain "freiberg.xxxxxxxxx.de" to an external web server. In the docs section of Traefik I just found examples for other docker container configurations. What also confuses me is that in the services documentation the attribute for the forwarding url is "http.services.appv1.loadBalancer.servers.url" but in the Traefik docker compose reference there is no such attribute. Also, if I use the line "traefik.http.services.freiberg-oh.loadBalancer.servers.url=http://x.x.x.x:8080/" in my docker-compose.yml, I get an error message:
level=error msg="field not found, node: servers" providerName=docker container=traefik-traefik-fc2923843fdfd57d4cf6a8f5111832204a033d4d7195c3d91e1a10c827a366d3
If I get rid of the s at "servers", there is at least no error message but the forwarding is not working (Connection refused). Any advise?