Skip to content

Instantly share code, notes, and snippets.

@nnaku
Last active April 7, 2019 16:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnaku/6e1839487b934b0f17ad935ff6163269 to your computer and use it in GitHub Desktop.
Save nnaku/6e1839487b934b0f17ad935ff6163269 to your computer and use it in GitHub Desktop.
Docker with Traefik
# you can secure this dashboard with basic auth
# uncommnet label traefik.frontend.auth.basic
# and create basic auth with eq. htpasswd -n username (htpasswd comes with apache2-utils)
# YOU MUST ESCAPE THOSE 3 $ by adding another $ to them ($ -> $$) admin:$$apr1$$/Q.zw5dp$$TXbLwhnaiXWYTVSuv8QON.
version: "3"
services:
proxy:
image: traefik:v1.7.10-alpine
command: --web --docker --logLevel=INFO
restart: unless-stopped
networks:
- web
# traefik entryPoints
ports:
- "80:80"
- "443:443"
labels:
# - "traefik.frontend.auth.basic=<user:pwhash>"
- "traefik.frontend.rule=Host:dash.example.com"
- "traefik.port=8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/traefik.toml
- ./acme.json:/acme.json
networks:
web:
external: true
debug = false
defaultEntryPoints = ["https","http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "dash.example.com"
watch = true
exposedbydefault = false
[acme]
email = "valid@email.com"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"
[[acme.domains]]
main = "example.com"
sans = ["dash.example.com"]
[[acme.domains]]
main = "example2.com"
sans = ["foo.example.com","bar.example.com"]
# web provider configuration is deprecated, you should use these options : api, rest provider, ping and metrics
# liian läski korjaamaan vielä.
[web]
address = ":8080"
version: "3"
services:
server:
image: ghost:alpine
container_name: ghost
restart: unless-stopped
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:example.com"
- "traefik.port=2368"
volumes:
- ${PWD}/blog:/var/lib/ghost/content
environment:
- NODE_ENV=production
- url=https://example.com
networks:
web:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment