Docker Community Forums

Share and learn in the Docker community.

Docker network for Postgres + Golang REST API

As my first docker application, I am writing a Golang REST API for access to a Postgres database. The two containers are ‘glassnode_database’ and ‘glassnode_server’ [1]. Both containers start up alright with docker-compose up. Both containers are on the same network ‘glassnode_backend’. I can ping ‘glassnode_database’ from ‘glassnode_server’ and vice versa. I can access the database with psql from ‘glassnode_server’. But

curl localhost:8080

fails after startup. But after checking

docker network ls

once, the service works fine as expected. I would appreciate some advice how to continue debugging. Thanks.

[1] https://gist.github.com/lars20070/b5e2067665472e61c06d893351bb6309

How does it fail, do you get an error message or are you not able to connect?