dockercontainersdcos

Difference between container port,host port and service port in dcos json in portMappings


I am confused with what all these port signify container port,host port and service port in portMappings, below is my json

"portMappings": [
  {
    "containerPort": 9000,
    "hostPort": 9000,
    "labels": {
      "VIP_0": "/app2n:9000"
    },
    "protocol": "tcp",
    "servicePort": 10101
  }
]

Solution

  • Basically flow looks like this: internet -> <loadbalancer e.g. nginx, haproxy>:<servicePort> -> <mesos agent on which container runs>:<hostPort> -> <container>:<containerPort>