Skip to content

solution-libre/docker-traefik

Repository files navigation

Traefik with Docker Compose

Table of Contents

  1. Description
  2. Setup
  3. Usage
  4. Reference
  5. Development
  6. Contributors

Description

Docker Compose setup for starting Traefik with Let's Encrypt by Solution Libre.

Setup

  1. Create an external network:

    docker network create web
  2. Clone this repo:

    cd /opt
    git clone https://usine.solution-libre.fr/docker/traefik.git
    cd traefik
  3. Declare environment variables or copy the .env.dist to .env and adjust its values.

  4. Copy the .env.traefik.dist to .env.traefik and adjust its values.

Usage

cd /opt/traefik
docker compose up -d

For a service to be accessible through Traefik, it must:

  1. Be connected to the Traefik network (default web)
  2. 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: true

Reference

See REFERENCE.md.

Development

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

Contributors

The list of contributors can be found at: https://usine.solution-libre.fr/docker/traefik/-/graphs/main