I have a docker build script which builds a series of libraries and runs test suits. In order to make my build script run faster on a many core server, I changed put the sequential order of commands (being passed to RUN to a bash invocation of several parallel commands:
RUN /bin/bash -c -e '\
    cmd1 arg1 & \
    cmd2 & \
    cmd3 arg1 arg2=foo arg3 & \
    wait'
This worked file when there was no error. Then I realized even if one of child processes return a non-zero exit status, the whole bash command returns 0 and docker continues to build... How can I make the bash call to return 0 iff all its children return 0 ? 
 
    