Docker Compose setup for starting Traefik with Let's Encrypt by Solution Libre.
-
Create an external network:
docker network create web
-
Clone this repo:
cd /opt git clone https://usine.solution-libre.fr/docker/traefik.git cd traefik
-
Declare environment variables or copy the
.env.distto.envand adjust its values. -
Copy the
.env.traefik.distto.env.traefikand adjust its values.
cd /opt/traefik
docker compose up -dFor a service to be accessible through Traefik, it must:
- Be connected to the Traefik network (default
web) - Have the appropriate Docker labels
Example Docker Compose configuration for a service:
services:
myapp:
image: myapp:latest
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.myapp.rule=Host(`myapp.example.com`)"
- "traefik.http.routers.myapp.entrypoints=websecure"
- "traefik.http.routers.myapp.tls.certresolver=myresolver"
- "traefik.http.services.myapp.loadbalancer.server.port=80"
networks:
proxy:
external: trueSee REFERENCE.md.
Solution Libre's repositories are open projects, and community contributions are essential for keeping them great.
Fork this repo on our GitLab or on GitHub
The list of contributors can be found at: https://usine.solution-libre.fr/docker/traefik/-/graphs/main