meta data for this page
  •  

This is an old revision of the document!


Host access from container

/etc/hosts

Docker can automatically generate /etc/hosts to provide name resolution of other containers. This can be extended by:

docker run --add-host=host.docker.internal:host-gateway
docker-compose.yml
    extra_hosts:
      - "host.docker.internal:host-gateway"

List of usefull DNS aliases:

  1. host-gateway
  2. gateway.docker.internal
  3. host.docker.internal - (already exists on Win and MAC, for Linux manual mapping is needed)

NOTE: Supported in Docker version 20.10.0