Docker Community Forums

Share and learn in the Docker community.

Image being Skipped in Automated Tests

(Canton) #1

We have both unit tests and integration tests in our test suites. We have enabled automated repository test with a docker-compose.test.yml file. The integration test requires a database. The setup is to have a standard sut service linking to a database service. But we have having database uses an image, skipping error.

Not sure if this use case is not supported by Docker Cloud? Or are we having some mistakes somewhere?

The application is a ruby on rails web application. I am posting the (simplified) docker-compose.test.yml file as well as part of the build/test log, if they help.


  build: .
    - database
  command: ./
  image: 'postgres:9.4'

Part of build/test logs

Starting Test Starting Test in docker-compose.test.yml... 
Pulling database (postgres:9.4)... 
9.4: Pulling from library/postgres Digest: sha256:f51abce88b017a278ab7f68efd46a61d417f522231b271ede0f9d53903839271 
Status: Downloaded newer image for postgres:9.4 
database uses an image, skipping 
Building sut 
Step 1 : FROM ruby:2.3.1-alpine 
 ---> adae74697505 

(logs removed)

could not connect to server: Connection refused 
Is the server running on host "" and accepting 
TCP/IP connections on port 5432? 

(Pablo Chico de Guzman Huerta) #2


Sometimes the db takes a while to be up. Are you able to run the tests in your local env if you remove the database container? You might need to insert a delay before running your tests, or to do a while checking the db is up.

(Canton) #3

Thanks for your reply. The tests require a database. And I am able to run both sut and database containers in local machine. with the command docker-compose -f docker-compose.test.yml up

Specifically, in the build/test log (in docker cloud automated repository test), there is a line
database uses an image, skipping
I guess it suggests the database container is being skipped.

(Pablo Chico de Guzman Huerta) #4

That means it is skipping the build since it is using an image (it should be shown too when you run it locally).
Did you try adding a delay? There is not difference between what you run locally and what we run in the autobuild execution (more than the machine which is probably slower in the autobuild execution).

The error is:

could not connect to server: Connection refused
Is the server running on host “” and accepting
TCP/IP connections on port 5432?

which suggests that the db is not running yet, or it failed to start.

(Canton) #5

Thanks. It is working after waiting database to start.