We've been trying to get scripted pipelines to run steps inside docker images for a while now. Steps like bat, powershell, pswh, etc. would cause the build to hang.
After a lot of investigation the issue is soo easy to reproduce!
In Jenkins under "Configure System" > "Global properties" > "Environment variables" we had a variable that contained quotes and a space. Example: "C:\Program Files\Red Gate\SmartAssembly 7\SmartAssembly.com"
Here's a snippet from our Jenkinsfile:
(Note: Using docker.image had the same result.)
Removing the environment variable resolves the issue.