Add docker-compose example

This commit is contained in:
x-yuri 2020-05-18 03:13:41 +03:00 committed by GitHub
parent ceee81afb5
commit b08c110c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,58 @@ docker run ldez/traefik-certs-dumper:<tag_name>
**Note:** to dump data from Traefik v2, the CLI flag `--version v2` must be added.
### `docker-compose`
`docker-compose.yml`:
```yaml
version: '3'
services:
traefik:
image: traefik:1.7
command:
--entryPoints='Name:http Address::80'
--entryPoints='Name:https Address::443 TLS'
--defaultentrypoints=http,https
--logLevel=DEBUG
--docker
--docker.exposedByDefault=false
--acme
--acme.acmeLogging=true
--acme.entrypoint=https
--acme.storage=/data/acme.json
--acme.onHostRule=true
--acme.httpChallenge.entryPoint=http
ports:
- 8001:80
- 8002:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- .:/data
traefik-certs-dumper:
image: ldez/traefik-certs-dumper:v2.7.0
entrypoint: sh -c '
apk add jq
; while ! [ -e /data/acme.json ]
|| ! [ `jq ".Certificates | length" /data/acme.json` != 0 ]; do
sleep 1
; done
&& traefik-certs-dumper file --watch
--source /data/acme.json --dest /data/certs'
volumes:
- .:/data
whoami:
image: containous/whoami
labels:
traefik.enable: true
traefik.frontend.rule: Host:example.com
```
`traefik` ports are published to `8001` and `8002`. It's assumed here that you need certificates as separate files because you want to put `traefik` behind another proxy.
### Simple Dump
```console