I'm trying to spin up docker container when I run a particular configuration in intellij, which I have done successfully by adding a 'Before Launch external tool command', as described here: IntelliJ IDEA: Running a shell script as a Run/Debug Configuration
What doesn't seem obvious though is how I stop the container when the program has finished running? There doesn't seem to be any options for after.
How do I run a shell script when my run configuration finishes? (Either by reaching it's end, or being forcefully stopped).