Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bamboo does not respect exit status of docker compose

Hello all,


I am experiencing a problem where Bamboo does not seem to respect the exit code from docker compose to determine whether a task was successful or not. I configured the task as described below. As you can see in the log output below, the docker-compose process exits with status 1. Bamboo ignores this status code and reports the task as success.

  • Bamboo version: 6.9.1 build 60910
  • Docker version: 19.03.2, build 6a30dfc
  • Docker-compose version: 1.24.0, build 0aa59064

Bamboo task:

docker-compose -f test/docker-compose.yml up --exit-code-from tests

Where docker-compose is:

version: "3"
image: ${DOCKER_REGISTRY}selenium/hub:3.141.59
container_name: selenium-hub
image: ${DOCKER_REGISTRY}selenium/node-chrome:3.141.59
- selenium-hub
- HUB_HOST=selenium-hub
- HUB_PORT=4444
image: ${DOCKER_REGISTRY}selenium/node-firefox:3.141.59
- selenium-hub
- HUB_PORT_4444_TCP_ADDR=selenium-hub
- HUB_PORT_4444_TCP_PORT=4444
image: ${DOCKER_REGISTRY}node:12
command: bash -c "cp -R /data/. /workdir && npm install && npm run test"
- selenium-hub
- selenium-chrome
- selenium-firefox
- http_proxy=${http_proxy}
- https_proxy=${https_proxy}
- no_proxy=${no_proxy},selenium-hub,host
working_dir: /workdir
- ${HOME:-.}/.npmrc:/root/.npmrc:ro
- ${HOME:-.}/.gitconfig:/root/.gitconfig:ro
- ${HOME:-.}/.git-credentials:/root/.git-credentials:ro
- ..:/data:ro
- ./wct.docker.conf.json:/workdir/wct.conf.json:ro
driver: bridge

Log output:

tests_1             | npm ERR! code ELIFECYCLE
tests_1             | npm ERR! Exit status 1
test_tests_1 exited with code 1
Aborting on container exit...
Finished task 'Script' with result: Success


1 answer

1 accepted

1 vote
Answer accepted

Hi @cambiph

I'll need more details about the task running the docker-compose command.
If you are using a script task, there is an explanation for this issue and a fix using the proper configuration.

If we consider Bash, all the commands from a script will run even if any previous command failed. The script itself (or an inline script from a script task) will by default only return the error code of the last command run. To change this behavior you need to use the set -e command to configure the terminal interpreter to stop the script if any command return a non zero error. 

This is one example of a thread with a similar issue: 


Moving forward

  • Tell us what is the task used;
  • If you are using a script task, add the set -e command at the beginning of your script and check if the problem will be solved.

The 'set-e'-command works like a charm.

Thank you very much.

Like Daniel Santos likes this

You are welcome. I'm glad the issue is solved =]

Ahhh I forgot to thank you for the effort on sharing a lot of meaningful information and formatting it in a way that could make my work easier when investigating this.

Thank you very much!

Like # people like this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program 2

We’re preparing for Bamboo 8.0, which will be our first Data Center release. To make sure our app vendors and customers with written in-house apps are prepared, we’re launching Bamboo 8.0 Early Acces...

91 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you