Search code examples
dockerdocker-for-mac

Docker access container IP/Port directly


I have docker container for experiments. So I don't know which ports I will use later when I trying new apps. Isn't it possible to access docker container application with ip/port from the host without exposing it in the docker-run command?


Solution

  • It seems that it's impossible on Mac and Windows:

    Per-container IP addressing is not possible because the Docker bridge network is not reachable from the host.

    The only workaround offered is port forwarding to the host OR host network mode (in which container doesn't get its own IP-address at all).