Configure 'extra_hosts' Field of API Container inside docker-compose File
We need to configure the extra_hosts
field of the API container defined inside docker-compose.yaml
. When running on Windows, it is not needed, but when running on Linux, which is the case for our EC2, if we want to use the DNS host.docker.internal
, we must map it like this:
version: "3.8"
services:
api:
extra_hosts:
- "host.docker.internal:host-gateway"