将 docker compose 文件从 traefik v1 升级到 traefik v2
Upgrade docker compose file from traefik v1 to traefik v2
我目前正在试验 docker swarm 与 pihole 和 traefik 的结合。我的问题是我没有成功将 traefik v1.7.30 升级到 v2.6.1。有人知道 docker-compose 的正确标签吗?我正在搜索官方文档,但没有找到 docker-compose.
的配置
version: "3"
services:
pihole:
image: pihole/pihole:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
labels:
- 'traefik.docker.network=pihole_pihole'
- 'traefik.port=80'
- 'traefik.frontend.rule=PathPrefix:/'
- 'traefik.backend.loadbalancer.stickiness=true'
- 'traefik.enable=true'
volumes:
- pihole:/etc/pihole
- pihole_dnsmasq:/etc/dnsmasq.d
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
networks:
- pihole
environment:
- TZ='Europe/Berlin'
- WEBPASSWORD=<your-password>
- FTL_CMD=debug
- DNSMASQ_LISTENING=all
dns:
- 127.0.0.1
- 1.1.1.1
- 8.8.8.8
traefik:
image: traefik:v1.7.30
deploy:
placement:
constraints: [ node.role==manager ]
command:
--docker \
--docker.swarmmode \
--docker.watch --web --loglevel=DEBUG
ports:
- "80:80"
- "9090:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- default
- pihole
volumes:
pihole:
pihole_dnsmasq:
networks:
pihole:
我成功升级到 traefik v2。这是最终结果:
version: "3"
services:
pihole:
image: pihole/pihole:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
labels:
- traefik.enable=true
- traefik.docker.network=pihole_pihole
- traefik.http.routers.pihole.entrypoints=web
- traefik.http.routers.pihole.rule=PathPrefix("/")
- traefik.http.services.pihole.loadbalancer.server.port=80
- traefik.http.services.pihole.loadbalancer.sticky=true
- traefik.http.services.pihole.loadbalancer.sticky.cookie.name=StickyCookie
volumes:
- pihole:/etc/pihole
- pihole_dnsmasq:/etc/dnsmasq.d
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
networks:
- pihole
environment:
- TZ='Europe/Berlin'
- WEBPASSWORD=<your-password>
- FTL_CMD=debug
- DNSMASQ_LISTENING=all
dns:
- 127.0.0.1
- 1.1.1.1
- 8.8.8.8
traefik:
image: traefik:v2.6.1
deploy:
placement:
constraints: [ node.role==manager ]
command:
- --log.level=DEBUG
- --api.insecure=true
- --ping=true
- --entrypoints.web.address=:80
- --providers.docker.swarmmode=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=pihole_pihole
- --providers.docker.watch=true
ports:
- "80:80"
- "9090:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- default
- pihole
volumes:
pihole:
pihole_dnsmasq:
networks:
pihole:
我目前正在试验 docker swarm 与 pihole 和 traefik 的结合。我的问题是我没有成功将 traefik v1.7.30 升级到 v2.6.1。有人知道 docker-compose 的正确标签吗?我正在搜索官方文档,但没有找到 docker-compose.
的配置version: "3"
services:
pihole:
image: pihole/pihole:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
labels:
- 'traefik.docker.network=pihole_pihole'
- 'traefik.port=80'
- 'traefik.frontend.rule=PathPrefix:/'
- 'traefik.backend.loadbalancer.stickiness=true'
- 'traefik.enable=true'
volumes:
- pihole:/etc/pihole
- pihole_dnsmasq:/etc/dnsmasq.d
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
networks:
- pihole
environment:
- TZ='Europe/Berlin'
- WEBPASSWORD=<your-password>
- FTL_CMD=debug
- DNSMASQ_LISTENING=all
dns:
- 127.0.0.1
- 1.1.1.1
- 8.8.8.8
traefik:
image: traefik:v1.7.30
deploy:
placement:
constraints: [ node.role==manager ]
command:
--docker \
--docker.swarmmode \
--docker.watch --web --loglevel=DEBUG
ports:
- "80:80"
- "9090:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- default
- pihole
volumes:
pihole:
pihole_dnsmasq:
networks:
pihole:
我成功升级到 traefik v2。这是最终结果:
version: "3"
services:
pihole:
image: pihole/pihole:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
labels:
- traefik.enable=true
- traefik.docker.network=pihole_pihole
- traefik.http.routers.pihole.entrypoints=web
- traefik.http.routers.pihole.rule=PathPrefix("/")
- traefik.http.services.pihole.loadbalancer.server.port=80
- traefik.http.services.pihole.loadbalancer.sticky=true
- traefik.http.services.pihole.loadbalancer.sticky.cookie.name=StickyCookie
volumes:
- pihole:/etc/pihole
- pihole_dnsmasq:/etc/dnsmasq.d
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
networks:
- pihole
environment:
- TZ='Europe/Berlin'
- WEBPASSWORD=<your-password>
- FTL_CMD=debug
- DNSMASQ_LISTENING=all
dns:
- 127.0.0.1
- 1.1.1.1
- 8.8.8.8
traefik:
image: traefik:v2.6.1
deploy:
placement:
constraints: [ node.role==manager ]
command:
- --log.level=DEBUG
- --api.insecure=true
- --ping=true
- --entrypoints.web.address=:80
- --providers.docker.swarmmode=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=pihole_pihole
- --providers.docker.watch=true
ports:
- "80:80"
- "9090:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- default
- pihole
volumes:
pihole:
pihole_dnsmasq:
networks:
pihole: