We haven't experienced this. Our host OS is windows 2019. nohup is never called during bat. Our workaround for nohup when using `sh` is to install git using chocolatey with GitAndUnixToolsOnPath parameter. This is our Jenkins windows agents (our Windows base images only have Docker installed) Today I would use the existing DockerImage created in Jenkins org: https://github.com/jenkinsci/docker-jnlp-slave/blob/master/Dockerfile-windows
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1'')); `
cinst docker-cli docker-compose adoptopenjdk8jre powershell-preview -y --no-progress; `
cinst git --params '/GitAndUnixToolsOnPath /SChannel' -y --no-progress
# temporary fix for powershell preview
RUN [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\PowerShell\7-preview", [EnvironmentVariableTarget]::Machine)
# Adding Jenkins Setup last to avoid rebuild
ADD JenkinsAgentSetup.ps1 .
ENTRYPOINT ["powershell.exe","-executionpolicy", "bypass", "./JenkinsAgentSetup.ps1"]
This is how we run the agent
docker run `
--dns 10.0.0.1 `
--dns 1.1.1.1 `
--dns-search company.io `
--name jenkins.agent `
-v "$($WORKSPACE):$($JENKINS_WORKSPACE)" `
-v \\.\pipe\docker_engine:\\.\pipe\docker_engine `
-e "JENKINS_MASTER_URL=$JENKINS_MASTER_URL" `
-e "JENKINS_AGENT_NAME=$JENKINS_AGENT_NAME" `
-e "JENKINS_AGENT_PARAMETERS=$JENKINS_AGENT_PARAMETERS" `
-e "JENKINS_AGENT_SECRET=$JENKINS_AGENT_SECRET" `
artifactory.company.io/docker/jenkins.agent.windows:latest
|