for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Install-WindowsFeature fails in Windows Server Core Docker Image Build

Open vikalyan opened this issue 9 years ago • 7 comments

Expected behavior

Installing Windows features via Install-WindowsFeature should succeed.

Actual behavior

This fails with an error indicating that the container requires a restart.

Information

Windows Server 2016 Datacenter with Containers Docker version 17.03.1-ee-3, build 3fcee33

Steps to reproduce the behavior

use the following in a Dockerfile:-

FROM microsoft/dotnet-framework:3.5

RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command \
    "Install-WindowsFeature -Name 'NET-Framework-45-Features' -IncludeAllSubFeature -Verbose" 

When using docker build to build the image, you will see the following output:-

Using Docker to build image from .
Sending build context to Docker daemon 6.656 kB
Step 1/9 : FROM microsoft/dotnet-framework:3.5
 ---> 66759a1de4d0
Step 2/9 : LABEL maintainer 'XXXX'
 ---> Using cache
 ---> 90287d0ba512
Step 3/9 : LABEL support 'XXX'
 ---> Using cache
 ---> b675b7f9fe09
Step 4/9 : RUN powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -Name 'NET-Framework-45-Features' -IncludeAllSubFeature -Verbose"
 ---> Running in 4b70132f68f2
VERBOSE: Installation started...
VERBOSE: Continue with installation?
VERBOSE: Prerequisite processing started...
VERBOSE: Prerequisite processing succeeded.
Install-WindowsFeature : The request to add or remove features on the
specified server failed.
The operation cannot be completed, because the server that you specified
requires a restart.
At line:1 char:1
+ Install-WindowsFeature -Name 'NET-Framework-45-Features' -IncludeAllS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : DeviceError: (@{Vhd=; Credent...Name=localhost}:
   PSObject) [Install-WindowsFeature], Exception
    + FullyQualifiedErrorId : DISMAPI_Error__Failed_Reboot_Required,Microsoft.
   Windows.ServerManager.Commands.AddWindowsFeatureCommand

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
False   No             Failed         {}
VERBOSE: Installation succeeded.


Removing intermediate container 4b70132f68f2
The command 'cmd /S /C powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -Command     "Install-WindowsFeature -Name 'NET-Framework-45-Features' -IncludeAllSubFeature -Verbose"' returned a non-zero code: 1

This seems like a fairly basic step that anyone might do. There was at least one previously filed issue about using the Add-WindowsFeature cmdlet but it looks like that issue was unrelated.

@jhowardmsft @darrenstahlmsft

vikalyan avatar Jul 02 '17 00:07 vikalyan

I think we need to close this issue here. It needs to be taken up with the Microsoft Windows product team since the failure is in the Windows feature installer processes which are closed source

PatrickLang avatar Jul 05 '17 18:07 PatrickLang

@PatrickLang thx - please post back if you get an internal or external issue handle that people interested in this can use to track progress.

friism avatar Jul 05 '17 19:07 friism

@PatrickLang Sure. I have gotten around the problem by rebuilding from scratch off the Windows Server Core image. That seems to work. Posted data internally as well.

vikalyan avatar Jul 05 '17 23:07 vikalyan

@PatrickLang Hi Patrick, it is reasonable to assume that: Add-WindowsFeature -name NET-Non-HTTP-Activ; (hosting of tcp services in IIS) Should work? Is there a document describing which server roles and feature are available in servercore?

AssimaSA avatar Feb 14 '18 14:02 AssimaSA

Hi, has this been resolved? I have a need to have an Active Directory Doman Controller for local Docker development because some of our legacy applictions need to talk directly to Active Directory using the WinNT:// type of calls using .NET's System.DirectoryServices, I've tried to add features to a Docker Windows2016 Core container, I connect to the container in interactive mode and run the following powershell command:

install-windowsfeature AD-Domain-Services -Confirm:$false

I then get the same error as @vikalyan

is there any resolution to this?

doughjoe77 avatar Apr 18 '18 13:04 doughjoe77

@doughjoe77 that's a bit of a different issue. the AD Role isn't supported in containers. We do have support to run containers using an Active Directory Group Managed Service Account (GMSA) - here's a page on it - https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/manage-serviceaccounts

PatrickLang avatar Apr 18 '18 15:04 PatrickLang

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jun 22 '20 03:06 docker-robott