It’s hard to tell if this is an issue with the CircleCI infrastructure or docker-compose. It seems to me as if the containers weren’t actually running/available while docker-compose thought they were running.
Normally for HTTP tests, I run them inside a DC container using docker exec, since a container cannot be made to listen inside a CircleCI build container. However you say that this works in SSH?
Have you defined a start-up order in Docker Compose? You can specify which services are dependent on others, so they start in the right order
You may need to do a wait in your build container for a service to become available. Docker Compose’s job is to start containers, but a container start does not mean the service within it is ready. It is common here to use waitforit or dockerise on a port to see if it is listening.