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

Container start command option - Argument parsing

      This bug concerns container start commands with one or more command line options.

      If a container is run from command line like :

      docker run -it <image_hash> "tail -n 20 /etc/passwd"
      

      the "tail -n 20 /etc/passwd" command is interpreted as:

          "Path": "/bin/sh",
          "Args": [
              "-c",
              "tail -n 20 /etc/passwd"
          ],
      

      However if I add the same command without quotes in "Container start command" option it is interpreted as :

          "Path": "/bin/sh",
          "Args": [
              "-c",
              "tail",
              "-n",
              "20",
              "/etc/passwd"
          ],
      

      If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :

          "Path": "/bin/sh",
          "Args": [
              "-c",
              "'tail",
              "-n",
              "20",
              "/etc/passwd'"
          ],
      

      Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.

          [JENKINS-32010] Container start command option - Argument parsing

          Paris Zoumpouloglou created issue -
          Paris Zoumpouloglou made changes -
          Description Original: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :

          {{docker run -it <image_hash> "tail -n 20 /etc/passwd"
          }}
          the "tail -n 20 /etc/passwd" command is interpreted as:

          {{ "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],}}

          However if I add the same command without quotes in "Container start command" option it is interpreted as :

          {{ "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],}}

          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :

          {{ "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],
          }}

          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.
          New: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :

          docker run -it <image_hash> "tail -n 20 /etc/passwd"

          the "tail -n 20 /etc/passwd" command is interpreted as:

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],

          However if I add the same command without quotes in "Container start command" option it is interpreted as :

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],

          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],

          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.
          Paris Zoumpouloglou made changes -
          Description Original: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :

          docker run -it <image_hash> "tail -n 20 /etc/passwd"

          the "tail -n 20 /etc/passwd" command is interpreted as:

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],

          However if I add the same command without quotes in "Container start command" option it is interpreted as :

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],

          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :

              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],

          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.
          New: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :


          {code:java}
          docker run -it <image_hash> "tail -n 20 /etc/passwd"

          {code}

          the "tail -n 20 /etc/passwd" command is interpreted as:


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],
          {code}


          However if I add the same command without quotes in "Container start command" option it is interpreted as :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],
          {code}


          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],
          {code}


          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.
          Paris Zoumpouloglou made changes -
          Attachment New: container_start_command.png [ 31428 ]
          Environment New: Jenkins 1.639
          docker-custom-build-environment:1.6.4
          Summary Original: Container start command argument parsing New: Container start command option - Argument parsing
          Paris Zoumpouloglou made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Paris Zoumpouloglou made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Paris Zoumpouloglou made changes -
          Description Original: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :


          {code:java}
          docker run -it <image_hash> "tail -n 20 /etc/passwd"

          {code}

          the "tail -n 20 /etc/passwd" command is interpreted as:


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],
          {code}


          However if I add the same command without quotes in "Container start command" option it is interpreted as :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],
          {code}


          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],
          {code}


          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.
          New: This bug concerns container start commands with one or more command line options.

          If a container is run from command line like :


          {code:java}
          docker run -it <image_hash> "tail -n 20 /etc/passwd"
          {code}

          the "tail -n 20 /etc/passwd" command is interpreted as:


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail -n 20 /etc/passwd"
              ],
          {code}


          However if I add the same command without quotes in "Container start command" option it is interpreted as :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "tail",
                  "-n",
                  "20",
                  "/etc/passwd"
              ],
          {code}


          If I enclose the command in single or double quotes the problem remains since the command is interpreted as (example using single quotes) :


          {code:java}
              "Path": "/bin/sh",
              "Args": [
                  "-c",
                  "'tail",
                  "-n",
                  "20",
                  "/etc/passwd'"
              ],
          {code}


          Both cases result in errors and the container does not start. I searched through the documentation but there are no recommendations regarding this option.

          why do you need to pass such a start command ? This is an advanced feature for people who need to start some subprocess as part of the container (which is wrong way to use docker imho, but anyway ...)
          simple workaround is for you to wrap this into a shell script inside your image.

          Nicolas De Loof added a comment - why do you need to pass such a start command ? This is an advanced feature for people who need to start some subprocess as part of the container (which is wrong way to use docker imho, but anyway ...) simple workaround is for you to wrap this into a shell script inside your image.

          Paris Zoumpouloglou added a comment - - edited

          This command is just an example

          The general problem is that the plugin cannot parse a command with command line options.

          In my case I want the image to be re-used in different jobs, whose start commands will differ. Since Docker accepts command line options, I believe this feature should support them too.

          Paris Zoumpouloglou added a comment - - edited This command is just an example The general problem is that the plugin cannot parse a command with command line options. In my case I want the image to be re-used in different jobs, whose start commands will differ. Since Docker accepts command line options, I believe this feature should support them too.
          Nicolas De Loof made changes -
          Priority Original: Blocker [ 1 ] New: Minor [ 4 ]

            Unassigned Unassigned
            zubu Paris Zoumpouloglou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: