This might be a really weird or edge case scenario, but what If we need to access host service(s) from inside a Docker container. For instance, we already have configured and running a service on the dev host machine and kinda lazy to dockerize it.
Docker supports a
host-gateway reference to the host’s gateway. This will allows us to map a host endpoint to the
From the CLI:
docker run --rm -it --add-host host.docker.internal:host-gateway alpine:latest
services: test_service: extra_hosts: - host.docker.internal:host-gateway
TL;DR add an additional host entry
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.