Created
December 29, 2019 07:44
-
-
Save jitheshkt/0adb6104fd6dabc9f4e335c1ca67215c to your computer and use it in GitHub Desktop.
Traefik 2.0 with Docker Compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
traefik: | |
image: traefik:v2.0 | |
container_name: traefik | |
restart: unless-stopped | |
security_opt: | |
- no-new-privileges:true | |
networks: | |
- proxy | |
ports: | |
- 80:80 | |
- 443:443 | |
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.middlewares.traefik-auth.basicauth.users=USER:PASSWORD" | |
# - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https" | |
# - "traefik.http.routers.traefik.middlewares=traefik-https-redirect" | |
- "traefik.http.routers.traefik-secure.entrypoints=https" | |
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.yoursite.com`)" | |
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth" | |
- "traefik.http.routers.traefik-secure.tls=true" | |
- "traefik.http.routers.traefik-secure.tls.certresolver=http" | |
- "traefik.http.routers.traefik-secure.service=api@internal" | |
networks: | |
proxy: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment