Skip to content

brett-fitz/docker-traefik

Repository files navigation

docker-traefik

Secure implementation of Traefik

img.png ❤️ tested with Qualys SSL Labs

Overview

This docker implementation of Traefik was inspired by Dale Picou's Traefik image. There are two key differences between his image and mine:

  • Utilizes the latest version of Traefik.
  • Implements a secure HTTP middleware that allows all HTTP methods

Docker Hub 📦 https://hub.docker.com/r/brettfitz/traefik

How to use 📝

Docker Compose 📝

When defining your Traefik service, specify the image and add the provider:

traefik:
    image: brettfitz/traefik:latest
    ...
    command:
      - --providers.file.filename=/configs/traefik_dynamic_config.yml

Middlewares 🔀

To add a middleware, apply the deploy label to your container. ⚠️ You must include the @file with the middleware name, which tells Traefik to use the file provider to find it.

Available middlewares:

  • https-redirect
  • secure-headers
  • secure-headers-all-methods
  • secure-headers-no-csp
  • compress-content

HTTPs redirect only ↪️

- "traefik.http.routers.myrouter.middlewares=https-redirect@file"

HTTPs redirect + secure-headers 🔒

- "traefik.http.routers.myrouter.middlewares=https-redirect@file, secure-headers@file"

Help / Troubleshooting 👷

Contact me on Twitter @_brettfitz or submit a GitHub issue!