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

Feature Request: Add exec/inner Method to Container Object

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Would be very handy to be able to connect to a running container from within a withRun block. I'm thinking it would behave exactly like inside(), except that it would run docker exec to run a command in the container. For example, if you needed to run a Postgres server with an extension installed, you could do it something like this:

      script {
          image('postgres:10').withRun('-p 5432:5432') { c ->
              c.inside {
                  // Attached to the Postgres container.
                  sh "apt-get update"
                  sh "apt-get install hypopg"
              }
              // Do stuff that relies on Postgres with hypopg
          }
      }

      I would think there would be plenty of use cases for spinning up a container and doing a bit of configuration on it before using a service it provides.

      (Dupe GitHub Issue)

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              theory David Wheeler
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: