# Example compose file, in your real compose file replace the whoami service with your service version: '3.4' services: lb: build: . environment: - APP_NAME=whoami # The name of the service to load balance - APP_PORT=2001 # The port of the service to load balance, default '80' ports: - "80:80" deploy: placement: constraints: [node.role == manager] # Required for swarm mode, lb should be on manager node depends_on: - whoami # The name of your service to load balance # Using whoami as an example, replace with your actual service to load balance whoami: image: traefik/whoami command: # It tells whoami to start listening on 2001 instead of 80 - --port=2001