-
Use
--network="host"
in your docker run command, then 127.0.0.1 in your docker container will point to your docker host. -
Get host IP by running following command. Then you should reach the host from container.
ip addr show docker0 | grep -Po 'inet \K[\d.]+'
# 172.17.0.1
Add the following parameter to your service:
extra_hosts:
- "host.docker.internal:172.17.0.1"
Then you can reach via the alias path.