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

Default -d image.run does not allow -a flag for docker.run

XMLWordPrintable

      Currently the image.run command runs in detached mode (-d). Give that the first parameter is args to docker and it is required, users should pass this as -d if they want. Currently you have to pass empty string if you want to use docker run.
      [line 142 here](https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/docker/workflow/Docker.groovy)
      Example:

      Today it would return a detached container:

      node {
         docker.image("ubuntu").run('', 'npm test')
      }
      

      How it could be:

      node {
          docker.image("ubuntu").run('-d', 'npm test')
      }
      

      Using attach for example:

      node {
          docker.image("ubuntu").run('-a STDOUT', 'npm test')
      }
      

      This second example today is not even possible, since -a STDOUT -d result in a conflict and docker ends in exception.

            Unassigned Unassigned
            camiloribeiro Camilo Ribeiro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: