Reputation: 5207
I am running a Dockerfile but every time it stops at one point.
RUN powershell %windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+"[name='Test',path='Test.cgi',verb='*',modules="IsapiModule",scriptProcessor="c:\Test.dll",resourceType="Unspecified", preCondition="bitness64"]"
Failed to process input: The parameter 'verb=*' must begin with a / or -
I am struggling for hours. What could be the reason?
Upvotes: 1
Views: 872
Reputation: 438763
You're trying to invoke appcmd.exe
via PowerShell (powershell.exe
), even though the appcmd.exe
command line doesn't require the features of that shell - it seems to be composed of literal strings only.
Your use of %windir%
implies that your Dockerfile uses the default shell on Windows, namely cmd.exe
Therefore, you should be able to formulate your appcmd.exe
command line as you would submit it from a cmd.exe
session:
RUN %windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+[name='Test',path='Test.cgi',verb='*',modules='IsapiModule',scriptProcessor='c:\Test.dll',resourceType='Unspecified',preCondition='bitness64']
Note:
All quoting in the remainder of the argument that starts with /+
now uses only '...'
, for consistency; since no argument-internal "
chars. are therefore in play, the need to escape them goes away.
No spaces are allowed in the remainder of the argument.
As for what you tried:
When you use the -Command
/ -c
PowerShell CLI parameter (which is implied in the absence of -File
), "
characters to be passed through as part of the PowerShell command must be escaped as \"
.
Since your /+
argument also contains embedded "
chars., as part of the argument, you would have to escape them twice, namely as `\"
(sic)
Upvotes: 1