Issues enabling IIS-ASPNET module in windows nano server - windows

I am running an application that requires IIS-ASPNET & IIS-ASPNET45 features enabled. When i run below commands in windowsservercore container it runs fine, but fails in nano server with below error message.
PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 -all
Enable-WindowsOptionalFeature : Feature name IIS-ASPNET45 is unknown.
At line:1 char:1
+ Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 -all
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMExcepti
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand
Can someone help,

New Windows nanoserver images (1709+) do not feature IIS option anymore. Only older versions do. See comparison of original nanoserver image vs 1709.
Here is details link
PS C:\> docker run -it --rm microsoft/nanoserver powershell get-windowsoptionalfeature -FeatureName IIS-ASPNET45 -online
PS C:\> docker run -it --rm microsoft/nanoserver:1709 powershell get-windowsoptionalfeature -FeatureName IIS-ASPNET45 -online
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container 19e874a98ea8bdd2175f2f1052adadc0b8ee015178f00441e874189addf729ad encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"powershell get-windowsoptionalfeature -FeatureName IIS-ASPNET45 -online","User":"ContainerUser","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[64,213]}.

Related

Problem with Docker on Windows Server 2019: not running Linux containers

I was trying to install Docker on a fresh Windows Server 2019 using this guide (other guides seem to use the same procedure).
NB: I was given a Windows Server 2019 with Hyper-V installed, but with no virtual machine.
My installation commands were:
Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart
Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Restart-Computer –Force
And then:
Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true
Which returns an error:
Get-VM : Hyper-V was unable to find a virtual machine with name "WinContainerHost".
At line:1 char:1
+ Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtens ...
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (WinContainerHost:String) [Get-VM], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM
Now, my first question is: what is WinContainerHost? Who did create it? I cannot see it in my Hyper-V Management Console.
Nevertheless, I try to go on with the Docker installation process:
Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
[Environment]::SetEnvironmentVariable(“LCOW_SUPPORTED”, “1”, “Machine”)
Restart-Service docker
After the process, typing docker --version, I get:
Docker version 17.10.0-ee-preview-3, build 1649af8
It seems that Docker is installed. I then try to launch a container with:
docker pull nginx:latest
which results in:
latest: Pulling from library/nginx
33847f680f63: Extracting [==================================================>] 27.15MB/27.15MB
dbb907d5159d: Download complete
8a268f30c42a: Download complete
b10cf527a02d: Download complete
c90b090c213b: Download complete
1f41b2f2bf94: Download complete
failed to register layer: failed to start service utility VM (applydiff 8f46920b86bdcdab20b89a73c657f59c52f0271fd2fa27bf87bb875c55c11f7a):
container 8f46920b86bdcdab20b89a73c657f59c52f0271fd2fa27bf87bb875c55c11f7a_svm encountered an error during CreateContainer: failure in a
Windows system call: The virtual machine could not be started because a required feature is not installed. (0xc0370102) extra info: {"SystemType"
:"container","Name":"8f46920b86bdcdab20b89a73c657f59c52f0271fd2fa27bf87bb875c55c11f7a_svm","Layers":null,"HvPartition":true,"HvRuntime":{"ImagePath"
:"C:\\Program Files\\Linux Containers","LinuxInitrdFile":"initrd.img","LinuxKernelFile":"bootx64.efi"},"ContainerType":"linux",
"TerminateOnLastHandleClosed":true}
My intuition tells me that the problem is with the Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true, but I cannot find a way to solve it.
Could someone please give me more insight on this? Thanks in advance.

Installing Print-Server on windows docker contaiener container fails

I am running a fresh mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
The first thing I try to do is install Print-Server but gives me an error (It is the first time I am installing a windows feature with powershell):
add-WindowsFeature -Name Print-Server
add-WindowsFeature : The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source
location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
At line:1 char:1
+ add-WindowsFeature -Name Print-Services -IncludeAllSubFeature
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (#{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager.Commands.AddWindowsFeatureCommand
I have tried to mount my host WinSxS inside the container and use the sources folder , but I get the same error.
Install-WindowsFeature -Name Print-Server -Source c:\sources
I have also tried online with Enable-WindowsOptionalFeature but gives me this error :
PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName Print-Server
Enable-WindowsOptionalFeature : Feature name Print-Server is unknown.
At line:1 char:1
+ Enable-WindowsOptionalFeature -Online -FeatureName Print-Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand
Looking at other questions this part seams to be working for other people. I am running windows 10 enterprise 2004.
Does someone know what can I do ?
From here:
The mcr.microsoft.com/windows image should be the targeted base image.
Other Windows container base images (such as Nano Server and Windows
Server Core) do not carry the Printing Server Role.

Not able to install packages using chcolatey in docker container

I am building a windows container with following software installed
Notepad++
MariaDB
HeidiSQL
.NET Framework 2.0 and 3.5
This is the docker image I created.
https://hub.docker.com/repository/docker/mhhaji/winserver2016_base
What I tried :
Steps to run the container
docker run --name mycontainer mhhaji/winserver2016_base:v1 ping -t localhost
docker exec -it mycontainer powershell
Once powershell is running,
I execute the following commands
Get-PackageProvider
#Chocolatey is not existing so I install chocolatey
Find-Package -Provider chocolatey
#Enter [Y] when prompted
#Install notepad++
Find-Package -Provider chocolatey -name notepad*
I get the following error
PS C:\> Find-Package -Provider chocolatey -name notepad*
WARNING: NuGet: The request was aborted: Could not create SSL/TLS secure channel.
PS C:\> Find-Package -Provider chocolatey -name mariadb
Find-Package : No match was found for the specified search criteria and package name 'mariadb' as registered package sources.
At line:1 char:1
+ Find-Package -Provider chocolatey -name mariadb
+ Categorylnfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPac
+ FullyQualifiedErrorld : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManage
PS C:\> Get-PackageSource
Name ProviderName IsTrusted Location
chocolatey Chocolatey False http://chocolatey.org/api/v
PSGallery PowerShellGet False https://www.powershellgalle
PS C:\> Get-PackageParameters
Get-PackageParameters : The term 'Get-PackageParameters' is not recognized as the name
o program. Check the spelling of the name, or if a path was included, verify that the path
At line:1 char:1
+ Get-PackageParameters
+ Categorylnfo : ObjectNotFound: (Get-PackageParameters:String) [], Command
+ FullyQualifiedErrorld : CommandNotFoundException
PS C:\> Get-PackageProvider
Name Version DynamicOptions
Chocolatey 2.8.5.130 SkipDependencies, ContinueOnFailure,
ExcludeVersion,ForceX86, PackageSaveMode, FilterOnTag, Contains,
AllowPrereleaseVersions, Conf
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber,SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscRes
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
I was able to download chocolatey so connecting to external endpoints doesnt seem to be a problem.
Update:
Seems like nuget is not installed in my image. Looking for solution but not able to find.
Make sure your system is able to support TLS 1.2 as that is necessary for chocolatey to run
PS> [Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'
Enable TLS 1.2 for your system
PS> [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Finally install chocolatey directly from source
PS> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));

Why docker switch to Linux containes error on Windows10 pc?

I want to use docker on win 10. But I can not use images by "pull " because My engine is Windows . so I want to change to Linux . but something wrong with me . (I can use docker before switch to Linux containers)
maybe my hyper-v is not normal. but how to fix it .
There is my error info:
Unable to create: The command that stopped the run because the
preference variable "ErrorActionPreference" or the generic parameter
is set to Stop: Since an object was not found, Hyper-V tried to access
the object on the computer "DESKTOP-ILCQ0I2" To the wrong. Verify that
the virtual machine management service on this computer is running. In
New-Switch, : Line 121 In , : line 411
   In the Docker.Core.Pipe.NamedPipeClient.Send(String action,
Object[] parameters) location
C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Core\pipe
\NamedPipeClient.cs: line number 36    In the
Docker.Actions.<>c__DisplayClass28_0.b__0() location
C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs: OK No. 305    In the
Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() location
C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.
Cs: line number 59
try the following commands:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
reboot then:
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All
if that does't work see this

Installing Docker on Windows Server 2016 TP4

I want to install Docker on a physical machine with Windows Server 2016 installed. (Using the Admin-Account, not a Guest or Normal User Account)
So i tried this guideline.
But the second command fails with following error:
Command: powershell.exe -NoProfile -ExecutionPolicy Bypass C:\Install-ContainerHost.ps1 -HyperV
...
Docker is already installed.
Installing ContainerImage provider...
C:\Install-ContainerHost.ps1 : Could not install ContainerImage provider
In Line:1 ...
+ C:\Install-ContainerHost.ps1 -HyperV
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException, Install-ContainerHost.ps1
I can't find a solution.. any Ideas?
EDIT/UPDATE:
I reinstalled the Windows Server 2016. After the first run of the script i get this error:
...
Downloading NSSM...
Extracting NSSM for archive...
Configuring NSSM for Docker service...
Starting Docker...
Waiting for Docker daemon...
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version: open //./pipe/docker_engine: Das System kann die angegebene Datei nicht finden.
...
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version: open //./pipe/docker_engine: Das System kann die angegebene Datei nicht finden.
C:\Users\Administrator\Install-ContainerHost.ps1 : Docker Daemon did not start successfully within 1 minute.
In Zeile:1 Zeichen:1
+ C:\Users\Administrator\Install-ContainerHost.ps1 -HyperV
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ContainerHost.ps1
In the following executions of the script i get the error in my first post.
I had the same exact problem and the following is how and what fixed it.
If you run Get-PSRepository on your system I was seetign the message "WARNING: Unable to find module repositories". Running on my Windows 10 box showed that i did have a repository setup.
I ran the following to set the same repository
powershell Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted
Everything worked a treat.
I am using the Windows Server 2016 TP5 but i think it this will solve your issue.
For whoever is looking an answer in 2021
I installed docker on Windows Server 2016 using the following commands on powershell as admin
Install-Module -Name DockerMsftProvider -Repository PSGallery –Force
Install-Package -Name docker -ProviderName DockerMsftProvider -verbose
get-service docker
start-service docker

Resources