Reputation: 2271
I am trying to run a simple Traefik container with a yml configuration to make some tests, but I cannot start it.
docker-compose.yml
version: '3.7'
services:
proxy:
image: traefik:v2.0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${PWD}/traefik.yml:/etc/traefik/traefik.yml
command:
- --providers.docker=true
- --providers.file.filename=/etc/traefik/traefik.yml
- --entryPoints.web.address=:7000
# - --providers.docker.swarmMode=true
- --log.level=DEBUG
ports:
- "9999:8080"
- "7000:80"
traefik.yml
http:
routers:
to-reg:
entryPoints:
- web
rule: Path(`/reg`)
service: srv-reg
services:
srv-reg:
loadBalancer:
servers:
- url: http://192.168.226.141:9900
When I run docker-compose up
, I get:
proxy_1 | 2019/10/02 11:29:33 command traefik error: invalid node traefik: no child
I am pretty sure I am doing a silly error, but I cannot understand which from the log.
Upvotes: 2
Views: 2296
Reputation: 2271
I finally found my error (and as expected is a silly one): I had not understood the distinction between static and dynamic configuration and I was mounting the dynamic one where traefik expects the static. This cause that strange error.
Once I renamed traefik.yml
in dyn-traefik.yml
I have been able to mount in /etc/traefik
and start the proxy with expected routing configuration.
Upvotes: 3