Calling local DB API endpoints from within a Docker container

I'm using the local Docker version of Supabase for development and having issues trying to access the endpoints from within another Docker container.

From the command line outside of Docker I can make a request as expected, for example

curl -X POST 'http://localhost:54321/rest/v1/rpc/my_function' \
-d '{ "input_var": "value" }' \
-H "Content-Type: application/json" \
-H "apikey: SUPABASE_KEY" \
-H "Authorization: Bearer SUPABASE_KEY"


And it returns the expected result
[{"id":2,"stream_id":1,"track_id":1817069...}]


But if I try to make the same request from within my Docker container I get an error
Error code: 523
Error message: Origin is unreachable


I've also tried using http://supabase_kong_my_project:8000/rest/v1/rpc/my_function instead of http://localhost:54321/rest/v1/rpc/my_function as the request URL but it gives me the same error.

Any help with this would be much appreciated, thanks!
Was this page helpful?