Skip to content

Instantly share code, notes, and snippets.

@neonima
Last active March 4, 2019 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neonima/41955c058600f3298c72faf9b02dce9e to your computer and use it in GitHub Desktop.
Save neonima/41955c058600f3298c72faf9b02dce9e to your computer and use it in GitHub Desktop.
version: '2'
services:
web:
image: hjacobs/tiny-docker-http-test
restart: always
ports:
- 8080:8080
container_name: web
networks:
- web
- default
expose:
- "9000"
labels:
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.basic.frontend.rule=Host:app.my.domain.com"
- "traefik.basic.port=8080"
- "traefik.basic.protocol=http"
networks:
web:
external: true

create traefick docker to create the reverse proxy that add the ssl certificate

docker network create web

the directory where reverse proxy will run

mkdir -p /opt/traefik

the required file for it to run

touch /opt/traefik/docker-compose.yml
touch /opt/traefik/acme.json && chmod 600 /opt/traefik/acme.json
touch /opt/traefik/traefik.toml
version: '2'
services:
traefik:
image: traefik:1.5.4
restart: always
ports:
- 80:80
- 443:443
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/traefik.toml:/traefik.toml
- /opt/traefik/acme.json:/acme.json
container_name: traefik
networks:
web:
external: true
debug = true
logLevel = "INFO"
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 = "my.domain.com"
watch = true
exposedByDefault = false
[acme]
email = "vincent@crypta.li"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment