Just in case anyone else needs it, here is my docker-compose file with traefik labels.
I have added a redirect to fix the streaming issue where you would get zm/zm and it would never load.
Using this for the last month on 1.34 and then to 1.36 and had no issue so far, use ZMninja work as well.
it set up to route www.ZM.mydomain.com to www.mydomain.com/ZM
Networks are not specified below, so when added, you will need to configure a network adapter for it to use that traefik can route to.
Code: Select all
zoneminder:
restart: always
shm_size: 0.5gb
image: zoneminderhq/zoneminder:latest-ubuntu18.04
ports:
- '8032:80'
environment:
- TZ=GB
- ZM_DB_USER=$ZM_DB_USER
- ZM_DB_PASS=$ZM_DB_PASS
- ZM_DB_NAME=$ZM_DB_NAME
- ZM_DB_HOST=$ZM_DB_HOST
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/config
- /data/zmdockerdata:/var/cache/zoneminder/events
- /data/zmdockerdata/logs:/var/log/zoneminder
labels:
- "traefik.enable=true"
- "traefik.http.routers.zm.rule=Host(`zm.CHANGEME`)"
- "traefik.http.routers.zm.entrypoints=web,websecure"
- "traefik.http.routers.zm.service=zm"
- "traefik.http.routers.zm.tls.certresolver=myresolver"
- "traefik.http.services.zm.loadbalancer.server.port=80"
- "traefik.http.middlewares.add-zm.addprefix.prefix=/zm"
- "traefik.http.routers.zm.middlewares=add-zm@docker"
- "traefik.http.middlewares.redirect2.redirectregex.regex=https://(.*)/zm/zm/"
- "traefik.http.middlewares.redirect2.redirectregex.replacement=https://$${1}/"
- "traefik.http.middlewares.all-in-one1.chain.middlewares=add-zm,redirect2"
- "traefik.http.routers.zm.middlewares=all-in-one1@docker"
Code: Select all
api:
dashboard: true
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
certificatesResolvers:
myresolver:
acme:
email: CHANGEME
storage: acme.json
httpChallenge:
entryPoint: web
log:
level: DEBUG