Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs should clarify how to add Windows Feature that require server restart to container #155

Closed
mathiasconradt opened this issue Mar 3, 2016 · 15 comments

Comments

@mathiasconradt
Copy link

In the documentation, it should be clarified how Windows Features that require a "server restart" can be installed in a container. I tried it with different approaches and could not get i.e. the NetworkController installed.

Detailed problem description:

http://superuser.com/questions/1048025/how-to-install-a-windows-feature-on-docker-container-windows-2016-server-that

@scooley scooley assigned scooley and enderjbr and unassigned scooley Mar 30, 2016
neilpeterson pushed a commit that referenced this issue Apr 27, 2016
Fix Install-ContainerHost issues
@mathiasconradt
Copy link
Author

mathiasconradt commented May 19, 2016

This seems to have been a bug in TP4, as Neil Peterson confirmed, but it still exists in TP5 as well. Here is a screencase where the container hangs himself up once trying to add the NetworkController windows feature.
The entire container hangs, not even possible to stop it via docker stop anymore.

Here is a screencast: https://screenrecordings.tinytake.com/sf/NjY5MDI3XzMyMTExMDE

How to reproduce it:

  1. Start container:
    docker run --name="wincore" -it windowsservercore powershell
  2. Add Network Controller
    add-windowsfeature networkcontroller
    It tells you that you need to restart the server (assuming it's meant to restart the container)
  3. On the container host, run:
    docker restart wincore
    docker attach wincore
  4. Inside the container, run:
    get-windowsfeature *net*
    It will hang endlessly at 57%, neverending.
  5. Try to stop the container from outside:
    docker stop wincore
    Hangs endlessly as well. Only way to resolve it is to actually reboot the whole container host machine.
  6. After the reboot of the container host, run again:
    docker start wincore
    docker attach wincore
  7. Inside the container:
    get-windowsfeature *net*

Now, this time the call does not hang anymore, but unfortunately the NetworkController is still not installed and the status is back to "Available".

@mathiasconradt
Copy link
Author

I'm closing this ticket, since adding the NetworkController is not meant to be added inside the Docker container. See #269

@MikhailTymchukDX
Copy link

@mathiasconradt While adding a NetworkController is not meant to be added inside the Docker container. there are other cases, when we need to restart a container.

For example, we can install Docker inside the container, right? But it requires to restart a container, how to do that?

@friism
Copy link
Contributor

friism commented Sep 1, 2017

@MikhailTymchukDX you cannot run the Docker daemon inside a Windows Docker container.

@MikhailTymchukDX
Copy link

@friism Yes, because I can not install the Docker module without restart :)
That was just an example.

The original question remains the same - how to restart a container if any service/windows feature requires a restart?

@Moshik177
Copy link

you figure it out ? i am trying to install a program that require a reboot ( it's a windows exe ) how i do restart on docker ? the command docker container restart does restart like on windows? same impact?
(i am using docker for windows)

@nmb88
Copy link

nmb88 commented Jan 7, 2018

I agree with @MikhailTymchukDX, the question remains. If the answer is "it's not possible", can that just be said? Or perhaps, "it's a bug or a new feature that needs to be considered" should be the answer. I'm having the same problem with .NET 4.7 which is needed for a new feature in our application to run and it would be nice to know if we should delay the feature.

@goffinf
Copy link

goffinf commented Jan 17, 2018

Yep me too. Creating a Windows VSTS build agent as a docker image (MS only provide the Linux one at present), installing Visual Studio 2017 and the some of the workloads using Chocolatey, one of which (netweb I think) causes the docker build to fail because it creates a pending reboot state and the build can't continue. I posted this question to the docker forum only a couple of hours ago (I didn't see this one or I would have just added my use case here) : https://forums.docker.com/t/reboot-during-docker-build-on-windows-2016/44654

But the point remains, there are a lot of potential scenarios when creating Windows containers (in my case on 2016) that create the need for a reboot and, whilst its possible to suppress them, they still ultimately need to be satisfied. So it would be really helpful if someone from Docker/Microsoft would indicate whether this has any prospect of working at all.

Its not clear whether if a reboot is suppressed (assuming your installer type allows it) whether, if the build were able to continue to the next layer, the reboot state is resolved by virtue of starting a new container, or, if its the final layer, satisfied when a container is started from that image, but TBH that seems a bit unlikely.

@JonasBr68
Copy link

I finally managed to get Server-Media-Foundation installed and working in Windows Server Core 2016 Docker container. This might also work for other windows server features installs.
I wrote a small article about it with further details

Quick steps to build Docker image

  1. Make sure to use a base image that is based off microrosft/windowsservercore build number 14393 (Windows Server 2016)
  2. Patch up all the C:\Windows\servicing\Packages*.mum and remove any restart="required" attributes
  3. Install-WindowsFeature Server-Media-Foundation
  4. You can do some basic validation that MF is working now, see Validation below
  5. Now you should be good to go...

Docker file and script

You can find a Dockerfile and the script used to patch up the .mum files on here on GitHub

@dermeister0
Copy link

@friism
I try to install an update for .NET framework (KB4470502) using DISM like here:
https://github.com/Microsoft/dotnet-framework-docker/blob/master/3.5/runtime/windowsservercore-ltsc2019/Dockerfile#L23

DISM returns exit code 3010 - restart required. What do you recommend in this case?

@Mendallas
Copy link

Mendallas commented Sep 4, 2019

Create a install.cmd file with in it :
@if not defined _echo echo off
setlocal enabledelayedexpansion

call %*
if "%ERRORLEVEL%"=="3010" (
exit /b 0
) else (
if not "%ERRORLEVEL%"=="0" (
set ERR=%ERRORLEVEL%
call C:\TEMP\collect.exe -zip:C:\vslogs.zip
exit /b !ERR!
)
)

then in your Dockerfile :
COPY Install.cmd C:/TEMP/
RUN C:\TEMP\Install.cmd dism.exe /online /enable-feature /all /featurename:whatever /NoRestart

Source : https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container

@idemax
Copy link

idemax commented Feb 18, 2020

No fix or workaround for this problem so far?!

@TunerBuilder
Copy link

Any update?

@shomrai
Copy link

shomrai commented Aug 29, 2020

Anything new related to the need of rebooting a Windows container (2020 Aug 29?)

@wamra
Copy link

wamra commented Jul 19, 2021

Windows 1909 doesn't require a restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests