The idea here is to stand up the Traefik container separately to the rest of your docker-compose files so it can act as a system wide reverse proxy.
You need to create a proxy network before bringing up Traefik
docker network create proxy
Edit the .env
variables file then bring up the traefik instance with the normal docker compose up -d
.
Then all you need to do is make sure other docker-compose files have the proxy network included and the labels for Traefik like in this example-docker-compose.yml file.
I usually keep these in different directories so they stay separated.
.
├── traefik
│ └── docker-compose.yml
└── example
└── docker-compose.yml