docker-compose inside Action: Wrong return code

Hello. 

I’m currently using docker-compose inside a github action to run a CI job. Unfortunately the version of docker-compose has a bug that causes a zero return code to be produced when my target process is aborted.

For example, I am spinning up a mysql service which my node.js tests depend on inside a docker-compose set of containers. When I use the following github action, the error code of the aborted test container (api) is swallowed:

name: Docker CI

on: [push]

jobs:
    build:

        runs-on: ubuntu-latest

        steps:
            - uses: actions/checkout@v1
            - name: docker compose up and test
                run: |
                    docker-compose version
                    docker-compose up --force-recreate --exit-code-from api
                    echo $?

Reported docker-compose version is:  docker-compose version 1.22.0, build f46880fe

Which contains this bug: https://github.com/docker/compose/issues/5966

When this runs and the mysql container fails to launch which subsequently kills my api container, the echo command prints “0” on github, but prints 137 on my local machine as expected.

Is it possible to update the docker version running on the instances github actions is on?

1 Like

Whether the OS of your local machine is Ubuntu? If so, you can try installing a self-hosted runner on your local machine to run your workflow.
Self-hosted runners offer more control of hardware, operating system, and software tools than GitHub-hosted runners provide.

1 Like