Note 6/6/2020: This only works on Macs and Windows, but if you know how to make it work on Linux leave a comment on Github
Yes, I don’t just do frontend development. I know some Docker. Just recently, I wanted to connect the APIs inside my docker-containers to what was outside my docker containers, the host.
I tried doing http://localhost:8080
, but I realized I am a silly goose! That’s within the container, so that will not work.
Turns out docker has a special keyword 1 :
host.docker.internal
Now, in docker-compose, whenever I want to setup a Hasura Event Trigger, and I haven’t dockerize my app yet, all I need to do is the following things:
- Never hardcode the event trigger, use a environment varaible.
- In docker-compose, I can use the following:
EVENT_TRIGGER: http://host.docker.internal:8080