What is the equivalent of –add-host=host.docker.internal:host-gateway in a Compose file
The actual Docker Compose equivalent is achieved by appending the same string to the extra_hosts parameters (#Doc) as: version: ‘3.9’ services: postgres: image: postgres:14.1-bullseye environment: POSTGRES_PASSWORD: **** ports: – “5433:5432” extra_hosts: – “host.docker.internal:host-gateway” You can see it has been successfully mapped to the IP of the docker0 interface, here 172.17.0.1, from inside your container, e.g.: …