I’m setting up two containers in a Google Cloud Run service (which run on same host):
- ingress nginx proxy
- my http service
I got these running locally on Mac, but when deploying to Google Cloud Run, I’ve hit:
nginx [emerg] host not found in upstream host.docker.internal
because I’m using host.docker.internal
in nginx configuration, and host.docker.internal
isn’t defined (on Linux) as I found out (nginx - From inside of a Docker container, how do I connect to the localhost of the machine? - Stack Overflow)
First of all this sucks – why does this work on Mac, but not on Linux … seems like host.docker.internal
should be always available!? (Explore networking features on Docker Desktop | Docker Docs)
There seem to be few workarounds for this sucky thing:
- pass
--add-host="host.docker.internal:172.17.0.1"
to thedocker run
command - pass
--network=host
and use ‘localhost’ - using docker-compose.yml and actually building an image with
/etc/hosts
containing the mapping.
Cloud Run service config provides two text fields – “Container Command” and “Container Arguments” – but I can’t figure out how to actually use them, it’s like some alien technology - and I can’t find good documentation or examples.
What am I missing here? I thought this would take me 30 min to 3 hours to set up an Nginx proxy, but it’s already close to 3 days. Please help.