Docker is the main containerization technology
Suppose the case in which we have a DB server running on the host and
want to connect to it from inside a docker container. An easy solution
for this would be to use --network=host
when launching the container,
but this is not always possible (or if you\'re using Docker on Windows,
at least not today: [2020-10-15 Thu]).
Note: In the future (pending the resolution of this
issue) we can use
host.docker.internal
to access the bridge between container and
host. Although this functionality seems to be working fine in MacOS and
Windows.
In linux we can use the command ip a
to find the IP address of the
docker0
interface. We can then use this IP from within the container
to reference the bridge. See
this stackoverflow
answer for more details.