Docker container seemed unavaible in linux VM. Job succeeds on rerun

I’m running a job that uses docker-compose in a linux VM. It failed so I ssh’d in but then it worked without a hitch. I reran without ssh as well and than it worked too.
Failed run: https://circleci.com/gh/pytest-docker-compose/pytest-docker-compose/37
ssh run: https://circleci.com/gh/pytest-docker-compose/pytest-docker-compose/38
Succeeded run: https://circleci.com/gh/pytest-docker-compose/pytest-docker-compose/39

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.

A few things to think about:

  • 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.