Stopping docker run, consistent with CI

I have a very slow script that calls docker run . I run it locally and also in CI. (Travis.)

– if I use -it , I get an error in CI:

Error “The input device is not a TTY”

– If I don’t use -it , I can’t interrupt the script with CTRL-C.

Is there a workaround that works with CI?