extra_hosts:
- "host.docker.internal:host-gateway"
would work as:
extra_hosts:
- "host.docker.internal:172.17.0.1"
This is neither a requirement, nor is it wrong to use extra_hosts to let the container inject this name resolution into the containers /etc/host. Or you just use the host’s hostname or ip.
If this is not working, replace 172.17.0.1 (ip of docker0) with 172.18.0.1 (ip of docker_gwbridge).