2016-11-04 122 views
0

我有一些问题使用docker for windows运行iis/php环境。事实上很多问题,但让我们从这一开始:)Docker Windows容器 - DockerFile设置iis默认文档

我的机器是Windows 10临周年,和容器,是基于WindowsCore的。

我有一个powershell命令,如果我在容器中运行将更新默认文档,但不从DockerFile工作。

RUN powershell.exe -Command \ 
    Import-module IISAdministration; \ 
    Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" | Get-IISConfigCollection -CollectionName "files" | New-IISConfigCollectionElement -ConfigAttribute @{"Value" = "index2.php"} 

'GET-IISConfigCollection' 不被识别为内部或外部 命令,可操作的程序或批处理文件“。

然而,容器内的以下命令工作正常:

Get-IISConfigSection -SectionPath "system.webServer/defaultDocument" | Get-IISConfigCollection -CollectionName "files" | New-IISConfigCollectionElement -ConfigAttribute @{"Value" = "index2.php"} 

与此命令相关的问题:

Add-WebConfigurationProperty -Filter "//defaultDocument/files" -PSPath "IIS:\sites\mysite" -AtIndex 0 -Name "Collection" -Value "index2.php" 

它工作正常,我的主机上,但不是在容器中,不在DockerFile中。

所以..

我是否需要更新的地方PS?

从DockerFile中设置iis默认文档(第一个索引)的正确方法是什么?

感谢

码头工人的版本信息:

> `PS E:\Docker> docker version 
Client: 
Version:  1.13.0-dev 
API version: 1.25 
Go version: go1.7.3 
Git commit: 16bcc1a 
Built:  Fri Nov 4 08:04:41 2016 
OS/Arch:  windows/amd64 

Server: 
Version:  1.13.0-dev 
API version: 1.25 
Go version: go1.7.3 
Git commit: 16bcc1a 
Built:  Fri Nov 4 08:04:41 2016 
OS/Arch:  windows/amd64 
Experimental: false` 

回答

0

有一些事情与逃避,有的摆弄了以下工作后:

RUN powershell.exe -Command " \ 
Import-module WebAdministration; \ 
Get-IISConfigSection -SectionPath system.webServer/defaultDocument | Get-IISConfigCollection -CollectionName files | New-IISConfigCollectionElement -ConfigAttribute @{'Value' = 'index2.php'} "