Hi,
I am new to Traefik (and so I begin with v2) bur far from it to Docker.
I am moving all my servers to a new server and take advantage of the move to dockerize them all. Hence my need for Traefik.
But I cannot say I find the doc self explanatory. So, here I am asking for some help.
The context is simple: I would like two project management containers to run concurrently on the same machine (my Ubuntu desktop for now). I have specified hostnames for each (I obfuscate the domain name):
- one is a Gitlab container, lab.lan.mydomain
- the other one is documentation server (Sismics Docs): kdo.lan.mydomain
They both publish on the port 80, and I do not need to connect to the outer world, so no need to use https.
Each of them, opened separately, works perfectly.
But as they both publish on port 80, I need Traefik.
So here is what I have done (I use docker-compose and prefer NOT to use the Traefik TOML configuration file in order to keep it simple and in one place):
The Traefik docker-compose file:
version: "3"
services:
tfk:
image: "traefik:v2.0"
container_name: "tfk"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
I am able:
- to connect to the Traefik dashboard. All good.
The Gitlab docker-compose file
version: "3"
services:
lab:
hostname: lab.lan.<mydomain>
restart: unless-stopped
environment:
- POSTGRES_PASS=ouie
volumes:
- "/media/cool/gitlab/logs:/var/log/gitlab"
- "/media/cool/gitlab/config:/etc/gitlab"
- "/media/cool/gitlab/data:/var/opt/gitlab"
image: "gitlab/gitlab-ce:latest"
labels:
- "traefik.enable=true"
- "traefik.http.routers.lab.rule=Host(`lab.docker.lan.<mydomain>`)"
- "traefik.http.services.lab.loadbalancer.server.port=80"
- "traefik.http.routers.lab.entrypoints=web"
I see the server registered properly in the Traefik dashboard.
The Sismics Docs docker-compose file
version: "3"
services:
doc:
hostname: kdo.lan.<mydomain>
restart: unless-stopped
volumes:
- "/media/photo/kuq-doc/docs/data:/data"
image: "sismics/docs:latest"
labels:
- "traefik.enable=true"
- "traefik.http.routers.doc.rule=Host(`kdo.docker.lan.<mydomain>`)"
- "traefik.http.services.doc.loadbalancer.server.port=80"
- "traefik.http.routers.doc.entrypoints=web"
I see the server registered properly in the Traefik dashboard.
But, when I try to connect to either of them using their hostname, I get a 404.
However, when I try to connect to their docker inner IP address (172...), I am able to connect to each of them, but of course that is not the point of using Traefik.
What am I doing wrong/forgetting.
Please help.
Best,
Stephen