Эй, товарищи по переполнению стека!
Недавно я столкнулся с загвоздкой при попытке создать контейнер windows, который запускает IIS. В настоящее время мой файл dockerfile выглядит следующим образом:
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2-windowsservercore-ltsc2016
# Install Powershell
ADD https://github.com/PowerShell/PowerShell/releases/download/v7.0.0/PowerShell-7.0.0-win-x64.zip c:/powershell.zip
RUN powershell.exe -Command Expand-Archive c:/powershell.zip c:/PS7 ; Remove-Item c:/powershell.zip
RUN C:/PS7/pwsh.EXE -Command C:/PS7/Install-PowerShellRemoting.ps1
# Update shell to powershell (PS7)
SHELL ["C:/PS7/pwsh.EXE", "-command"]
# Install chocolatey
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install application dependencies via chocolatey
RUN choco install -y vcredist140
RUN choco install -y nuget.commandline
# Enable required IIS features
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebSockets;
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit;
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-BasicAuthentication;
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-WindowsAuthentication;
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionDynamic;
# Install IISAdministration to manage IIS configuration
RUN Install-Module -Name IISAdministration -Force -MinimumVersion "1.1.0.0";
# Remove default web site
RUN Remove-IISSite -Name 'Default Web Site'
Это приводит к следующей ошибке при вызове последней команды
Remove-IISSite: The term 'Remove-IISSite' 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.
Примечание: я использую PS7 в качестве текущего Powershell. версия, которая поставляется с указанным выше контейнером, не позволяет мне установить IISAdministration (что немного раздражает, но эй-хо! Возможно, я делаю что-то не так).
Любая помощь и / или совет по текущему ситуация была бы очень признательна!