Updating Powershell 7 version included with Jenkins Agent docker image

I’m having an issue when creating a Windows Jenkins container using jenkins/agent:jdk11-windowsservercore-ltsc2019. This version appears to come with Powershell 7.1.1 installed which is an old version out of support. I’m trying to include the lastest version (7.3.6 at time of writing this), but I’m stuck with version 7.1.1.

I can see when the image is being built that the intended version appears to install. If I run the container afterwards and run pwsh.exe it’s showing as 7.1.1, and $PSVersionTable confirms this. If I look at the MSI installer logs, it confirms that version 7.3.6 was installed to the default location of C:\Program Files\Powershell\7 but the pwsh.exe in this location is reporting version 7.1.1.

I’ve tried pulling and building a few other Jenkins images like jdk17-windowsservercore-ltsc2019 and I get the same issue. If I build a standard Windows Server 2019 image from Microsoft’s repository and apply my customisation, the correct version of Powershell 7 is installed.

My docker experience is quite limited and I’m not sure where to go next, how can I ensure that the intended version of Powershell 7 is installed over the top of the version that comes with the base image?

Using docker image jenkins/agent:jdk11-windowsservercore-ltsc2019
Operating system - Windows Server 2019
JDK 11
Jenkins: 2.414

Running in a docker container
No reverse proxy
Installed by pulling docker image jenkins/agent:jdk11-windowsservercore-ltsc2019 and customising with Dockerfile when building, file is included below

# escape=`
FROM jenkins/agent:jdk11-windowsservercore-ltsc2019
LABEL Description="Test build"

# Install Chocolatey
ENV chocolateyVersion=1.4.0
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install latest Powershell 7
RUN choco install -y powershell-core

ENTRYPOINT ["ping", "-n", "9999", ""]

Hello @macarotto and welcome to this community. :wave:

Wouldn’t you get better results starting from this image ( jenkins/agent:3142.vcfca_0cd92128-1-windowsservercore-ltsc2022) : Docker ?