Skip to content

Instantly share code, notes, and snippets.

@containeroo-gists
Created March 25, 2020 19:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save containeroo-gists/7b1d22e22df3dd6b2402d9b8e090f348 to your computer and use it in GitHub Desktop.
Save containeroo-gists/7b1d22e22df3dd6b2402d9b8e090f348 to your computer and use it in GitHub Desktop.
version: '3'
services:
traefik:
image: traefik:v2.2
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
environment:
- CF_API_EMAIL=your-cloudflare@email.com
- CF_API_KEY=your-cloudflare-api-key
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=https"
- "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=USER:PASSWORD"
- "traefik.http.routers.traefik.middlewares=traefik-auth"
- "traefik.http.routers.traefik.service=api@internal"
networks:
proxy:
external: true
@Antroxin
Copy link

Antroxin commented Jan 4, 2021

Thanks for the guide. I think config file volume is missing on line 23

volumes:
  - /etc/localtime:/etc/localtime:ro
  - /var/run/docker.sock:/var/run/docker.sock:ro
  - ./data/traefik.yml:/traefik.yml:ro
  - ./data/acme.json:/acme.json
  - ./data/config.yml:/config.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment