例えば、DBはローカルマシンで動いている時など。
ホストでDBが動作していて、15432ポートで動いているとする。
この場合、host.docker.internal:host-gateway:15432でコンテナからアクセスできる。
以下を対象リソースのセクションに追記する
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
ENV: "local"
DB_ENDPOINT: "host.docker.internal"
DB_PORT: 15432
参考
https://docs.docker.com/compose/compose-file/#extra_hosts
