docker swarm init --data-path-port=7789 --advertise-addr <ip-addr>
docker network create -d overlay --attachable proxy
Created
September 26, 2024 09:20
-
-
Save arsalanses/92e83473718b17653b5b0f3cfd31243d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
traefik: | |
image: docker.arvancloud.ir/traefik:v3 | |
command: | |
- "--log.level=ERROR" | |
- "--accesslog=true" | |
- "--accesslog.bufferingsize=250" | |
- "--ping=true" | |
- "--api=true" | |
- "--api.dashboard=true" | |
- "--entrypoints.http.address=:80" | |
# - "--providers.docker.swarmMode=true" | |
- "--providers.swarm=true" | |
- "--providers.swarm.network=proxy" | |
- "--providers.swarm.exposedByDefault=false" | |
- "--providers.docker=true" | |
- "--providers.docker.network=proxy" | |
- "--providers.docker.exposedbydefault=false" | |
- "--global.sendAnonymousUsage=false" | |
ports: | |
- "80:80" | |
volumes: | |
- "/var/run/docker.sock:/var/run/docker.sock:ro" | |
- "./acme.json:/acme.json" | |
networks: | |
- proxy | |
logging: | |
driver: "json-file" | |
options: | |
max-size: "10m" | |
max-file: "5" | |
deploy: | |
placement: | |
constraints: | |
- node.role == manager | |
labels: | |
- "traefik.enable=true" | |
- "traefik.docker.network=proxy" | |
- "traefik.http.routers.traefik.entrypoints=http" | |
- "traefik.http.routers.traefik.rule=Host(`swarm-traefik.172.16.0.1.traefik.me`)" | |
- "traefik.http.routers.traefik.service=api@internal" | |
- "traefik.http.services.traefik.loadbalancer.server.port=8080" | |
networks: | |
proxy: | |
driver: overlay | |
name: proxy | |
attachable: true | |
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
whoami: | |
image: docker.arvancloud.ir/traefik/whoami:latest | |
deploy: | |
replicas: 4 | |
# placement: | |
# constraints: | |
# - node.role == worker | |
labels: | |
- "traefik.enable=true" | |
- "traefik.docker.network=proxy" | |
# - "traefik.docker.lbswarm=true" | |
- "traefik.http.routers.whoami.entrypoints=http" | |
- "traefik.http.routers.whoami.rule=Host(`swarm-whoami.172.16.0.1.traefik.me`)" | |
- "traefik.http.routers.whoami.service=whoami" | |
- "traefik.http.services.whoami.loadbalancer.server.port=80" | |
networks: | |
- proxy | |
networks: | |
proxy: | |
driver: overlay | |
name: proxy | |
attachable: true | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment