Commit b1d58be9 authored by Stefan Scherer's avatar Stefan Scherer
Browse files

Patch windowsservercore base image for faster boot

parent 4a6725d7
# Workaround for slow exiting containers:
# https://social.msdn.microsoft.com/Forums/en-US/e2751260-4494-4b60-999e-5ea27ccbe1db/workaround-to-increase-boot-time-for-windows-server-core-containers?forum=windowscontainers
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
......@@ -102,6 +102,7 @@
"type": "powershell",
"scripts": [
"./scripts/install-docker.ps1",
"./scripts/patch-boot-time-for-containers.ps1",
"./scripts/enable-docker-insecure.ps1"
]
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment