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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins version 1.554.1, Ubuntu 14.04

      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

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

              Created:
              Updated:
              Resolved: