-
Bug
-
Resolution: Unresolved
-
Minor
-
None
If the path to the Jenkins workspace folder has a space in Windows the space is not properly handled when launching a Windows docker container with the docker workflow plugin.
Docker Desktop Version: 27.2.0
Image: mcr.microsoft.com/windows/nanoserver:ltsc2019
This can be reproduced by running docker for windows through a unit test.
Command:
docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c ""C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat""
Response:
'C:\git\docker-workflow-plugin\target\tmp\j\' is not recognized as an internal or external command, operable program or batch file.
There are two defects here:
1) The workdir needs to be quoted here
2) The consecutive double quotes ("") used when launching jenkins-wrapper.bat doesn't work with docker exec here
After experimenting it looks like the "cmd /c call" approach already used by the jenkins-wraper.bat works:
docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c call "C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat"
- relates to
-
JENKINS-74912 Jenkins docker-image plugin does not work with non-C windows drives
-
- Open
-
The problem seems to be how docker is handling the double quotes.
Example:
1. Create "C:/temp/folder with spaces/myscript.bat" with the contents "echo hi"
2. docker run -d -t -v "C:\temp\folder with spaces:C:\temp\folder with spaces" mcr.microsoft.com/windows/nanoserver:ltsc2019 (or some other tag that matches the Windows kernel)
3. docker exec <id> cmd /c ""C:\temp\folder with spaces\myscript.bat""
Output:
By setting DOCKER_HOST=tcp://localhost:2375 the REST call can be captured. Here is the body sent in: