Implement .inside{} wrapper for Container object

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Currently the workflow described in docs is something like this:

      docker.image('alpine').inside {
        sh 'X'
        sh 'Y'
      }

      It does not address the situations when you need to:

      1. run X  in container
      2. run Y in host agent
      3. run Z in the same container, preserving changes from 1

      The only solution to that, AFAIK, is something like this:

      docker.image('alpine').withRun { container ->
        sh "docker exec ${container.id} X"
        sh "Y"
        sh "docker exec ${container.id} Z"
      }

      As mentioned in JENKINS-39746 , this is kinda ugly, even if it could be rewritten as container.exec("X").

      It would be nice to have the ability to use .inside{...} not only on Image objects (source), but also on Container objects, to allow workflow like this:

      docker.image('alpine').withRun { container ->
        container.inside {
          sh "X"
        }
        sh "Y"
        container.inside {
          sh "Z"
        }
      }

            Assignee:
            Unassigned
            Reporter:
            Artalus S.
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: