Skip to content

Countries stats in docker swarm environment with traefik/ nginx reverse proxy #947

Answered by OCram85
OCram85 asked this question in Q&A
Discussion options

You must be logged in to vote

Just solved it:

traefik normally runs in docker swarm on a overlay network. The ports are published like this:

version: "3.8"
services:
  ...
  traefik:
    image: "traefik:v2.5"
    container_name: "traefik"
    restart: unless-stopped
    networks:
      - "traefik-public"
    ports:
      #- "80:80"
      #- "443:443"
...
networks:
  traefik-public:
    name: traefik-public
    external: true
    attachable: true

But the port-binding must be done via the host:

ports:
  #- "80:80"
  #- "443:443"
  - target: 80
    published: 80
    protocol: tcp
    mode: host
  - target: 443
    published: 443
    protocol: tcp
    mode: host

💡 NOTE: By publishing a port in host mode you bypass the sw…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@animesh-workplace
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by OCram85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants