1

We can map docker container port to host machine IP and port using

docker run -d -p <some-ip>:<port>:<port> --name <some-name> <docker-image>

But how to specify host machine IP while deploying the same container using Marathon? Where should I specify the IP of host machine in Marathon app spec? For my requirement specifying host IP is a necessity.

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
t6nand
  • 710
  • 1
  • 8
  • 20

1 Answers1

2

You can use Marathon constraints to influence the placement of your app but I'd suggest that a better, more forward-looking way is not to pin an app to a certain node (what if this node fails?) but use service discovery to dynamically figure out the IP and the port the app is serving on.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66
  • What if I deploy my docker container using host mode and not the bridge mode? What aspects of running container would and wouldn't be isolated from the host machine in that case? – t6nand May 14 '16 at 10:35
  • And, @t6nand: if you have additional questions, start a new one. This tagging onto an existing question is bad and not useful for people coming after you. – Michael Hausenblas May 14 '16 at 10:55