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

Allow Image.run() etc to provide arguments to the container's command

    XMLWordPrintable

Details

    Description

      Currently it is possible with the docker-workflow-plugin to provide arguments to the docker run command. However these are inserted into the command line before the image name.
      There does not appear to be any way to specify arguments to appear after the image name; so currently it does not appear to be possible to provide arguments to the container's entrypoint (without creating a custom Dockerfile with those commands built in).

      e.g. the scenario I would like to achieve is the equivalent of this command line:

      docker run --link=mysql-container:mysql --link=mongo-container:mongo maven:3.3.3-jdk-7 clean install
      

      Currently I could run

      docker.image('maven:3.3.3-jdk-7').run("--link=${mysql.id}:mysql --link=${mongo.id}:mongo");
      

      which would take care of the arguments to docker, but would not pass 'clean install' arguments to the mvn command which is maven:3.3.3-jdk-7's entrypoint.

      Currently the only way I see to do this is to use 'sh' to run the docker command line, and not use the docker-workflow-plugin for this container.

      Attachments

        Issue Links

          Activity

            ntdaley Nicholas Daley created issue -
            ntdaley Nicholas Daley made changes -
            Field Original Value New Value
            Description Currently it is possible with the docker-workflow-plugin to provide arguments to the docker run command. However these are inserted into the command line before the image name.
            There does not appear to be any way to specify arguments to appear after the image name; so currently it does not appear to be possible to provide arguments to the container's entrypoint (without creating a custom Dockerfile with those commands built in).

            e.g. the scenario I would like to achieve is the equivalent of this command line:

            {code}
            docker run --link mysql-container:mysql --link mongo-container:mongo maven:3.3.3-jdk-7 clean install
            {code}

            Currently I could run
            {code}
            docker.image('maven:3.3.3-jdk-7').run("--link ${mysql.id}:mysql --link ${mongo.id}:mongo");
            {code}
            which would take care of the arguments to docker, but would not pass 'clean install' arguments to the mvn command which is maven:3.3.3-jdk-7's entrypoint.

            Currently the only way I see to do this is to use 'sh' to run the docker command line, and not use the docker-workflow-plugin for this container.


            Currently it is possible with the docker-workflow-plugin to provide arguments to the docker run command. However these are inserted into the command line before the image name.
            There does not appear to be any way to specify arguments to appear after the image name; so currently it does not appear to be possible to provide arguments to the container's entrypoint (without creating a custom Dockerfile with those commands built in).

            e.g. the scenario I would like to achieve is the equivalent of this command line:

            {code}
            docker run --link=mysql-container:mysql --link=mongo-container:mongo maven:3.3.3-jdk-7 clean install
            {code}

            Currently I could run
            {code}
            docker.image('maven:3.3.3-jdk-7').run("--link=${mysql.id}:mysql --link=${mongo.id}:mongo");
            {code}
            which would take care of the arguments to docker, but would not pass 'clean install' arguments to the mvn command which is maven:3.3.3-jdk-7's entrypoint.

            Currently the only way I see to do this is to use 'sh' to run the docker command line, and not use the docker-workflow-plugin for this container.


            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 37 (Web Link)" [ 14074 ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ] Viktor Farcic [ vfarcic ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-34050 [ JENKINS-34050 ]
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Link This issue blocks JENKINS-36332 [ JENKINS-36332 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 168916 ] JNJira + In-Review [ 198494 ]

            People

              vfarcic Viktor Farcic
              ntdaley Nicholas Daley
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: