Docker-compose run exit codes

All docker-compose run commands always exit with code 0. How can I force the build to fail?

1 Like

I’ve been using docker-compose run in my tests for months, they fail and circleci fails if one of my tests fails.

Here is how I call my tests:

docker-compose run test /srv/www/test.sh

It might be relevant to observe that my bash script has the following header:

#!/bin/bash

set -o nounset
set -o errexit

I have similar error on database step. My shell script is like this. Similar code on test return exit code correctly, but not on database steps.

#!/bin/sh

set -ex

docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml run -e RAILS_ENV=test -e RACK_ENV=test web bin/rake db:create db:structure:load