正确的Docker语法-自定义错误的add-WebConfiguration

时间:2019-07-09 11:58:50

标签: powershell docker iis

我正在服务器2016上为IIS构建一个docker映像。在Dockerfile中创建IIS站点并将相关文件复制到整个站点之后,我想在IIS站点中添加2个客户错误页面。我还需要删除现有的。

我已经在我的Dockerfile中添加了以下powershell命令:

add-WebConfiguration -Filter /System.WebServer/HttpErrors -Value @{StatusCode=500;PrefixLanguageFilePath="$Null";  Path="~/custom_errors/500page.asp"; ResponseMode="ExecuteURL"}; `
add-WebConfiguration -Filter /System.WebServer/HttpErrors -Value @{StatusCode=404;PrefixLanguageFilePath="$Null";  Path="~/custom_errors/404page.asp"; ResponseMode="ExecuteURL"}

但是运行docker build时我收到错误消息

~/custom_errors/500page.asp : The term '~/custom_errors/500page.asp' is not
recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:330
+ ... efixLanguageFilePath=$Null;  Path=~/custom_errors/500page.asp; Respon ...
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (~/custom_errors/500page.asp:Str
   ing) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

0 个答案:

没有答案