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.


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