Docker Community Forums

Share and learn in the Docker community.

Capturing an exit/shutdown of Windows Container via PowerShell

(Brendanthompson) #1

Hi All,

Struggling a little bit with the delights of windows and powershell.

Essentially what I am trying to achieve is to perform an action when the docker stop is called, or if the container exits badly. I am able to achieve this via trap in bash but when i attempt to use Try...Catch...Finally blocks in PoSH it doesn’t respect the Catch or Finally.

Just seeking some advice on how I could best get the script to execute on Finally. I am using a powershell script as my entrypoint currently.