compose: 'fig up' should return with non-zero exit-code if some container "failed"

fig run <container> does already return the exit-code of the container (see #197) but fig up returns with 0 no matter what the exit-code of the started containers is.

It would be helpful to able to detect, if one of the containers returned with a non-zero exit code and have fig return a non-zero exit-code in that case, too.

Also, fig up does end with exit-code 1 if one of the containers could not be started at all, and also if one does Ctl-C once, but it ends with exit-code 0 of one does Ctl-C twice. It would be more in line with “standard unix behavior” if fig would exit with -2 in case of single Ctl-C (SIGINT) and -9 in case of double Ctl-C (SIGKILL).

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 2
  • Comments: 24

Most upvoted comments

copy paste example of using inspect:

docker-compose ps -q | xargs docker inspect -f '{{ .State.ExitCode }}' | grep -v 0 | wc -l | tr -d ' '

  1. get container IDs
  2. get last runs exit code for each container ID
  3. only non-0 status codes
  4. count number of non-0 status codes
  5. trim out white space

Returns how many non-0 exit codes were returned. Would be 0 if everything exited with code 0.