Skip to content

Instantly share code, notes, and snippets.

@michaelgreenhill
Last active January 9, 2020 07:52
Show Gist options
  • Save michaelgreenhill/bff6271b9ed88d528ffdf75b3a27bd1e to your computer and use it in GitHub Desktop.
Save michaelgreenhill/bff6271b9ed88d528ffdf75b3a27bd1e to your computer and use it in GitHub Desktop.
Traefik v2 example configuration
version: "3.3"
services:
traefik:
image: "traefik:latest"
container_name: "selby-traefik01"
restart: always
environment:
- TZ=Australia/Melbourne
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/share/Container/traefik/config/traefik.toml:/etc/traefik/traefik.toml:rw"
- "/share/Container/traefik/config/acme.json:/etc/traefik/acme.json:rw"
- "/share/Container/traefik/log:/etc/traefik/log:rw"
- "/share/Container/traefik/providers/file:/etc/traefik/providers/file:rw"
networks:
default:
ipv4_address: 192.168.178.37
traefik_default:
networks:
default:
external:
name: qnet-static-eth0-b03c93
traefik_default:
external: true
################################################################
#
# Configuration sample for Traefik v2.
#
# For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml
#
################################################################
################################################################
# Global configuration
################################################################
[global]
checkNewVersion = true
sendAnonymousUsage = true
################################################################
# Entrypoints configuration
################################################################
[serversTransport]
insecureSkipVerify = true
# Entrypoints definition
#
# Optional
# Default:
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[certificatesResolvers.le.acme]
# Be sure to change this to a valid email address, otherwise you might miss out on expiry notices!
email = "myemail@domaindomaindomain.com"
storage = "/etc/traefik/acme.json"
[certificatesResolvers.le.acme.httpChallenge]
# used during the challenge
entryPoint = "web"
################################################################
# Traefik logs configuration
################################################################
# Traefik logs
# Enabled by default and log to stdout
#
# Optional
#
[log]
# Log level
#
# Optional
# Default: "ERROR"
#
# level = "DEBUG"
# Sets the filepath for the traefik log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
filePath = "/etc/traefik/log/traefik.log"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# Access logs configuration
################################################################
# Enable access logs
# By default it will write to stdout and produce logs in the textual
# Common Log Format (CLF), extended with additional fields.
#
# Optional
#
# [accessLog]
# Sets the file path for the access log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
# filePath = "/path/to/log/log.txt"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# API and dashboard configuration
################################################################
# Enable API and dashboard
[api]
insecure = true
dashboard = true
################################################################
# Ping configuration
################################################################
# Enable ping
[ping]
# Name of the related entry point
#
# Optional
# Default: "traefik"
#
# entryPoint = "traefik"
################################################################
# Docker configuration backend
################################################################
# Enable Docker configuration backend
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = true
watch = true
defaultRule = "Host(`{{ normalize .Name }}.your-fqdn.com`)"
[providers.file]
directory = "/etc/traefik/providers/file"
watch = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment