What is linux equivalent of "host.docker.internal"

klor picture klor · Jan 31, 2018 · Viewed 84.9k times · Source

On Mac and Windows it is possible to use docker.for.mac.host.internal (replaces docker.for.mac.localhost) and docker.for.win.host.internal (replaces docker.for.win.localhost) host.docker.internal (Docker 18.03+) inside container.

Is there one for Linux that will work out of the box without passing env variables or extracting it using various CLI commands?

Answer

devnev picture devnev · Jan 31, 2018

Depends what you're trying to do. If you're running with --net=host, localhost should work fine. If you're using default networking, use the static IP 172.17.0.1. I suspect neither will behave quite the same as those domains.