This repository provides a Docker Compose setup for Traefik, a modern reverse proxy and load balancer. It includes:
- Automatic HTTPS with Let's Encrypt.
- Secure access to the Traefik Dashboard with Basic Authentication.
- HTTP to HTTPS redirection.
- Docker and Docker Compose installed.
- A domain name (e.g.,
example.com
) pointed to your server's IP address.
-
Clone this repository:
git clone https://github.com/your-username/traefik-docker.git cd traefik-docker
-
Generate Basic Authentication
The Traefik Dashboard is protected with Basic Authentication. To generate a new username and password hash, use the following command:Note: When used in docker-compose.yml, all dollar signs (
$) in the hash need to be doubled ($ $) for escaping. More detailshtpasswd -nb admin securepassword
-
Update the docker-compose.yml file:
- Replace your email for Let's Encrypt.
- Replace your domain for the Traefik Dashboard.
- Replace the Basic Auth hash with your own (use htpasswd to generate it).
-
Create the external Docker network
Run the following command to create the external Docker network:docker network create ingress-controller
-
Start the Traefik service:
Start the Traefik service using Docker Compose:docker-compose up -d
Feel free to open issues or submit pull requests for improvements.