microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
379 stars 243 forks source link

Routine for building generic images? #1495

Closed jwikman closed 3 years ago

jwikman commented 3 years ago

Describe the issue Yesterday our build server had a Windows Update, which is quite normal once in a while. But now there seems to be no generic image matching our hosts OS build version, so all containers are switching to Hyper-V.

From the container build logs:

Container OS Version: 10.0.17763.1577 (ltsc2019)
Host OS Version: 10.0.17763.1613 (ltsc2019)
Using hyperv isolation

Question

What is Microsofts routine for building generic images? What versions of the generic image can we expect, and when can we expect them?

I want to know this to be able to create a better Windows Update routine for our build servers. I want to be sure that there is a generic image available before updating the host OS.

Additional context

freddydk commented 3 years ago

You can add -isolation process to your container generation. We rely on .net 4.8 images: https://hub.docker.com/_/microsoft-dotnet-framework-runtime/ Their policy: Image Update Policy We update the supported .NET Framework images within 12 hours of any updates to their base images (e.g. windows/servercore:1909, windows/servercore:ltsc2019, etc.). We publish .NET Framework images as part of releasing new versions of .NET Framework including major/minor and servicing.

They rely on: https://hub.docker.com/_/microsoft-windows-servercore, which I query using:

$ver = [Version]"10.0.0.0"
$servercoretags = (get-navcontainerimagetags -imageName "mcr.microsoft.com/windows/servercore").tags | 
    Where-Object { [Version]::TryParse($_, [ref] $ver) } | 
    Sort-Object -Descending { [Version]$_ } | 
    Group-Object { [Version]"$(([Version]$_).Major).$(([Version]$_).Minor).$(([Version]$_).Build).0" } | % { if ($supported.contains($_.Name)) { $_.Group[0] } }

$servercoretags

We try to create new generics within 24 hours after .net 4.8. Currently this is a manual process, but we are working on automating this.

As you can see the version you have on the host hasn't shipped as a servercore image, so your only option at this time is to use -isolation process.

jwikman commented 3 years ago

Thanks Freddy,

In the past we've had several strange issues when running process isolation with different OS builds on host and container, so we now rely on Hyper-V isolation when they differ (through the default condition for this in New-NavImage and New-NavContainer) and I think we will keep it like this. I believe that Hyper-V isolation works fine, as long there is enough resources on the server. It seems as if the default 4G memory isn't enough anymore (all nextminor pipelines failed, but current version worked...), but everything runs fine again when I gave them 8G.

Now I understand the process of the generics, and if I don't find the new version on https://hub.docker.com/_/microsoft-windows-servercore I sure cannot blame you for not building generics on them ;)

Moving forward we'll have a manual process of validating the Cumulative Updates on the build server, to make sure that the generic image are available before updating the server.

Ps. When you are automating the creation of generic images, please also consider to update the web page (https://hub.docker.com/_/microsoft-businesscentral) with the new versions. In that way our technician can look at that page before applying updates, instead of running PowerShell to retrieve the latest created version. :)

freddydk commented 3 years ago

You found the new generic images: https://hub.docker.com/_/microsoft-businesscentral The latest preview containerhelper actually uses this as default - with SQL EXPRESS 2019 inside. I will check if this can be automated.