我有以下代码片段:
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 ]
无论操作是否成功,它都应该杀死容器。但是我注意到当操作失败时容器仍然保持启动并运行,这很烦人。我究竟做错了什么?