Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61498

Docker inside Docker not detected correctly with Windows Containers

      The logic in https://github.com/jenkinsci/docker-workflow-plugin/blob/5191865cd0126b3d25ef11fd03bf932c4178ea91/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L337 currently does not handle windows containers properly.

      The result of this is that the magic volumes from container logic https://github.com/jenkinsci/docker-workflow-plugin/blob/1089131014350e11adfa364d34e7717954350261/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L181 is not being invoked in cases where it's needed.

      In my situation I've worked around the issue by exposing making workspace root a bind mount to the same path on the host, but it would be nice if this "just works".

      At least when using the Docker Agent plugin (https://plugins.jenkins.io/docker-plugin/) it looks like the container ID is available inside the job as an environment variable DOCKER_CONTAINER_ID. I imagine this is a special case from the docker-plugin setting this up though. I'm not sure what the correct general way to determine the container id with Windows Containers, but leveraging DOCKER_CONTAINER_ID where available would be better than nothing.

          [JENKINS-61498] Docker inside Docker not detected correctly with Windows Containers

          Bram added a comment - - edited

          This seems to be a major rather blocking issue in terms of getting to build code using Windows build containers on the kubernetes platform (AKS).

          Both the mount of the work folder (as part of the inside() call) and the parsing of the returned containerid (as part of the withRun() call but probably also done during inside() call) to allow the "docker in docker" container to be stopped do fail.

          The latter issue is reported in https://issues.jenkins.io/browse/JENKINS-60016.

          As this issue is quite old, I hope someone is willing to help out for the Windows developers out there.

          Note: to get docker in docker (not really docker in docker) working on AKS Windows node; the jnlp container has mount to the \\.\pipe\docker-pipeline.

          (docker ee windows client version in use: 20.10.0 installed as extension on the jenkins/inboundagent:windowsservercore-1809 image; docker client build has been downloaded from https://dockermsft.azureedge.net/dockercontainer/docker-20-10-0.zip; installed plugin version: 1.26; jenkins version: 2.277.1)

           

          Bram added a comment - - edited This seems to be a major rather blocking issue in terms of getting to build code using Windows build containers on the kubernetes platform (AKS). Both the mount of the work folder (as part of the inside() call) and the parsing of the returned containerid (as part of the withRun() call but probably also done during inside() call) to allow the "docker in docker" container to be stopped do fail. The latter issue is reported in  https://issues.jenkins.io/browse/JENKINS-60016 . As this issue is quite old, I hope someone is willing to help out for the Windows developers out there. Note: to get docker in docker (not really docker in docker) working on AKS Windows node; the jnlp container has mount to the \\.\pipe\docker-pipeline. (docker ee windows client version in use: 20.10.0 installed as extension on the jenkins/inboundagent:windowsservercore-1809 image; docker client build has been downloaded from https://dockermsft.azureedge.net/dockercontainer/docker-20-10-0.zip ; installed plugin version: 1.26; jenkins version: 2.277.1)  

            Unassigned Unassigned
            nvx Tiernan Messmer
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: