Objective
proxy-traefikQuickly deploy Traefik in a separate Compose stackDocker and allow your applications to connect via a shared network.
For now, we’ll stick with HTTP (port 80) to simplify discovery and routing.
Step 1: Create the Traefik network
Before starting Traefik, create a shared external networkDocker:
docker network create proxy-traefik
This network will be used to connect Traefik and all web containers without directly exposing their internal ports.
Step 2: Minimal Traefik Docker Compose
Here is an example ofdocker-compose.yml a Docker Compose file for a simple deployment over HTTP:
networks:
proxy-traefik:
external: true
services:
traefik:
image: traefik:v3.6
container_name: traefik
restart: unless-stopped
command:
- "--api.insecure=true" # Dashboard accessible sur le port 8080
- "--providers.docker=true" # Découverte automatique des conteneurs Docker (labels activés mais à configurer plus tard)
- "--entrypoints.web.address=:80" # On expose uniquement le port HTTP pour l'instant
ports:
- "80:80" # Port HTTP pour tout le monde
- "8080:8080" # Dashboard Traefik
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- proxy-traefikStep 3: Launch Traefik
In the Traefik stack directory:
docker-compose up -d
- Traefik is now running and ready to listen on port 80 for your applications.
- The dashboard is accessible at http://localhost:8080, allowing you to verify that Traefik is working correctly.
Quick note: We’re sticking with HTTP for this step to simplify the configuration and focus on how Traefik works.