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

image.inside leaks volumes

XMLWordPrintable

      When using docker.inside(){....} jenkins does not clean up volume mounts. This fills the filesystem and can lead to failure of future builds due to space and/or handle exhaustion.

      Output from a jenkins job shows that the 'docker rm' command is missing the '-v' to clean up created volumes.

      pipeline:

          docker.image('imagename').inside {
            stage('NPM Install') {
                withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) {
                    sh 'npm install'
                }
              ... more stages...
            }
      

      output (shortened)

      [Pipeline] withDockerContainer
      $ docker run -t -d -u 501:65533 -w /var/jenkins_home/workspace/ker-jenkins_docker-delivery-XF3HYD5LNFF76MFG42DBYCT2GOEYPA563ZLXEPKNRCN35YXLGQPQ --volumes-from 1f171ac72b1c5e51759b2cde36d9360965ccf21a4fc64a52e107908371621b64 -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat <imagename>
      [Pipeline] {
      
      ....
      
      $ docker stop --time=1 b3c49f9e48e81c6955520fe8b7ab540990198c11e29491094764f18de0043f43
      $ docker rm -f b3c49f9e48e81c6955520fe8b7ab540990198c11e29491094764f18de0043f43
      [Pipeline] // withDockerContainer
      

            Unassigned Unassigned
            everflux Thomas Kruse
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: