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

PullImageCommand.isImagePulled() misuses DockerClient.listImagesCmd().withFilters()

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      PullImageCommand.isImagePulled() calls
      List<Image> images = client.listImagesCmd().withFilters(String.format("

      {\"%s\":[\"true\"]}

      ", fromImage)).exec();

      Syntax wise, it is correct, however, list image currently only accept one filter now, which is dangling (whose value is true or false).
      See https://docs.docker.com/reference/commandline/cli/#filtering_1,
      Also see here for the docker daemon implemenation:
      https://github.com/docker/docker/blob/v1.1.0/server/server.go#L668

      So the above call with fromImage as the filter simply doesn't do anything, and I have also Eclipse debug out below to prove this. The below debugger output is when it hits breakpoint inside of that function. Note that "fromImage" is "wzheng2310/foo", but the returned result contains only one entry " "tutum/hello-world:latest".

      his PullImageCommand (id=9570)
      fromImage "wzheng2310/foo" (id=9644)
      registry "" (id=9645)
      tag "1" (id=9646)
      client DockerClientImpl (id=9577)
      images ArrayList<E> (id=9578)
      elementData Object[10] (id=9579)
      [0] Image (id=9582)
      created 1416605801
      id "7e6d00854917cab52b56fb2f2fd6300b485462c6dacf42483215c341954dacaa" (id=9584)
      parentId "6853da9a3f45429aec73c2da79057ddb84af2322f874eb6a51d17ad2a4ceba61" (id=9585)
      repoTags String[1] (id=9586)
      [0] "tutum/hello-world:latest" (id=9587)
      hash -1796321746
      hash32 0
      value (id=9588)
      size 0
      virtualSize 255255458
      modCount 1
      size 1

        Attachments

          Activity

          Hide
          wzheng2310 Wei Z added a comment -

          Below is some console log that I added inside of isImagePulled() function to illustrate the problem better.

          [Docker] INFO: Pulling image wzheng2310/foo:1
          [Docker] INFO: isImagePulled: images size is 3
          [Docker] INFO: isImagePulled: image is wzheng2310/foo:1
          [Docker] INFO: isImagePulled: image is wzheng2310/foo:latest
          [Docker] INFO: isImagePulled: image is wei_private_repo/container-2:latest
          [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-1:1
          [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-1:latest
          [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-2:1
          [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-2:2
          [Docker] INFO: isImagePulled: image is wei_private_repo/container-1:latest
          [Docker] INFO: isImagePulled: image is debian:jessie

          Show
          wzheng2310 Wei Z added a comment - Below is some console log that I added inside of isImagePulled() function to illustrate the problem better. [Docker] INFO: Pulling image wzheng2310/foo:1 [Docker] INFO: isImagePulled: images size is 3 [Docker] INFO: isImagePulled: image is wzheng2310/foo:1 [Docker] INFO: isImagePulled: image is wzheng2310/foo:latest [Docker] INFO: isImagePulled: image is wei_private_repo/container-2:latest [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-1:1 [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-1:latest [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-2:1 [Docker] INFO: isImagePulled: image is xxxx.yyyy.com/wei_private_repo/container-2:2 [Docker] INFO: isImagePulled: image is wei_private_repo/container-1:latest [Docker] INFO: isImagePulled: image is debian:jessie
          Hide
          vjuranek vjuranek added a comment -
          Show
          vjuranek vjuranek added a comment - Should be fixed by https://github.com/jenkinsci/docker-build-step-plugin/pull/22

            People

            • Assignee:
              wzheng2310 Wei Z
              Reporter:
              wzheng2310 Wei Z
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: