0

我有以下与 microsoft/iis 一起使用,但我想让它与较小的 nanoserver 一起使用。当我用 nanoserver/iis 替换 microsoft/iis 时,这条线失败了。是不是因为 exe 文件无法在 nanoserver 中运行?

C:\vc_redist-x64.exe /quiet /install
FROM nanoserver/iis

这有效:

FROM microsoft/iis 

ADD PHP_7.3.26-NTS.zip C:\\php.zip
#unzip
RUN powershell -Command "expand-archive -Path 'c:\php.zip' -DestinationPath 'c:\test'"
#check path for source file php folder name if it changes!
RUN powershell -Command "Copy-item -Force -Recurse -Verbose 'c:\test\PHP_7.3.26-NTS' -Destination 'c:\php'"

ADD vc_redist-x64.exe C:\\vc_redist-x64.exe
ADD php_wincache.dll c:\\PHP\\ext\\php_wincache.dll
ADD php_pdo_sqlsrv_73_nts.dll c:\\PHP\\ext\\php_pdo_sqlsrv_73_nts.dll
ADD php_sqlsrv_73_nts.dll c:\\PHP\\ext\\php_sqlsrv_73_nts.dll
ADD php.ini C:\\php\\php.ini

# Enable required IIS Features
# Install VC Redist 14
# Configure IIS
# Configure system PATH
RUN dism.exe /Online /Enable-Feature /FeatureName:IIS-CGI /All && \
 C:\vc_redist-x64.exe /quiet /install && \
 del C:\vc_redist-x64.exe && \
 %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php\php-cgi.exe'] && \
 %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\php\php-cgi.exe',resourceType='Unspecified'] && \
[fullPath='c:\PHP\php-cgi.exe'].environmentVariables.[name='PHPRC',value='C:\PHP'] && \
 setx PATH /M %PATH%;C:\PHP && \
 setx PHP /M "C:\PHP"

# Optional: Add a starter page
RUN powershell.exe -Command "'<?php phpinfo(); ?>' | Out-File C:\inetpub\wwwroot\phpinfo.php" -Encoding UTF8

# ADD any application content and perform any configuration below
WORKDIR /inetpub/wwwroot

ADD web.config C:\\inetpub\\wwwroot\\web.config
4

1 回答 1

0

我一直在使用 Docker 中的 Nano Server,在 VMWare Workstation 16 下的 Windows Server 2019 实现上。

起初,我的 Visual Studio 64 位应用程序(我的 WIN-PROLOG 编译器的控制台模式变体)都不能在 Nanoserver 中运行 - 但后来我找到了解决方案。我只是手动将最新的 64/64 版本的 vcruntime140.dll 复制到与我的应用程序相同的文件夹中,然后宾果游戏 - 一切正常。

于 2021-05-12T09:12:36.857 回答