container snippets

How to access the host from a docker container

Tagged container, docker, host, ip  Languages bash

Access host from docker container IP:

# Mac
ping docker.for.mac.localhost

# Windows

# Linux: use the hosts external IP, see:

Note that it’s not possible to use host networking on Mac or Windows, only Linux:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.