Docker – add host.docker.internal on linux

If you need to connect from a docker container to something running on your local host, it can be a bit of a pain on Linux. On windows & Mac, there’s a special DNS entry ‘host.docker.internal’ which always points to the host machine. However that isn’t available on Linux (here’s a bug open for this as of May 2018: https://github.com/docker/for-linux/issues/264)

That bug report also contains a pretty good solution for this problem, so to save you wading through, simply add the following line to your docker file: