I have the following code fragment:
withContainer :: String -> (String -> Action a) -> Action a
cid <= cmd "docker" [ "run" , "--rm", "-d", my_image ]
...
actionFinally (action containerName) $ do
cmd_ "docker" [ "rm", "-f", filter (/= '\n') cid ]
which supposedly kill containers whether or not the action succeeds. However I noticed containers are still left up and running when the action fails, which is annoying. What am I doing wrong?
This sample of code looks correct, and testing variations of it in isolation does indeed work. A bug has been raised to figure out the precise reason it doesn't work in your case at https://github.com/ndmitchell/shake/issues/731.