Trying to learn traefik. And I get it to work in Docker Swarm.
Traefik starts but it cant see my services:
My traefik.yml file looks this:
################################################################
# API and dashboard configuration
################################################################
api:
# Dashboard
#
#
dashboard: true
insecure: true
################################################################
# Docker configuration backend
################################################################
providers:
docker:
watch: true
exposedByDefault: false
swarmMode: true
################################################################
# Traefik Logging
################################################################
log:
level: DEBUG
################################################################
# Entrypoint
################################################################
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
My stack file looks like this:
version: '3'
services:
traefik:
# The latest official supported Traefik docker image
image: traefik:v2.3
# Enables the Traefik Dashboard and tells Traefik to listen to docker
# enable --log.level=INFO so we can see what Traefik is doing in the log files
ports:
# Exposes port 80 for incomming web requests
- "80:80"
- "443:443"
# The Web UI port http://0.0.0.0:8080 (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- /home/robo/docker-volumes/traefik/traefik-yaml/traefik.yml:/etc/traefik/traefik.yml
# Add the catapp service
catapp:
# A Random Cat GIF generator application
image: mikesir87/cats:1.0
# We set a label to tell Traefik to assign a hostname to the new service
labels:
- "traefik.enable=true"
- "traefik.http.routers.catapp.rule=Host(`catapp.localhost`)"
- "traefik.http.routers.catapp.entrypoints=web"
- "traefik.http.services.catapp.loadbalancer.server.port=5000"
And these are my networks: