Posts tagged "docker":

03 Jan 2022

Accessing the host from inside a Docker container

To give the container access to a service running on the the host add extra_hosts to its definition in the Compose file:

svc:
  ...
  extra_hosts:
    - "host.docker.internal:host-gateway"

Then it's possible to access it as host.docker.internal. Just don't forget to bind the service on the host to something else than 127.0.0.1.

Tags: compose docker
Other posts