none
Workaround to increase boot time for Windows Server Core containers RRS feed

  • General discussion

  • Hello,

    We have heard your feedback for TP5, and we are working on fixing an issue that is slowing down the boot time for Windows Server Core based containers. This issue only happens the first time a Windows Server Core container is started, so the below script is a quick workaround for this.

    We are working on integrating this into our set up scripts, so in the future you will not need to run this script on your own.
    We are also working on a long term solution so that the windowsservercore base OS image does not have this issue anymore.

    Write-Host "Running windowsservercore once and tagging it as latest"
    
    # Remove containers
    if ($((docker ps -aq | Measure-Object -Line).Lines) -gt 0) {
        docker rm -f $(docker ps -aq)
    }
    
    # Untag if present
    if ($((docker images | where { $_ -match "windowsservercore" } | where { $_ -match "latest" } | Measure-Object -Line).Lines) -gt 0) {
       docker rmi windowsservercore:latest
    }
    
    # Find the build
    $build=docker images | where { $_ -match "windowsservercore" } | %{ $_.Split(' ')[3]; }
    
    # Run a container once
    docker run windowsservercore:$build cmd /s /c echo windowsservercore has started once
    
    # Commit the container
    $containerID=$(docker ps -aq)
    $imageID=$(docker commit $containerID | %{ $_.Split(':')[1] })
    docker tag $imageID windowsservercore:latest
    
    # Remove the temporary container
    docker rm $containerID
    
    Regards,
    Ender

    Wednesday, April 27, 2016 8:26 PM
    Moderator