This issue is archived. You can view it, but you can't modify it. Learn more

ExportXMLWordPrintable

      Right now, you can do:

      dimage = docker.image("whatever/whatever:99")
      

      This seems fine, until you try to spin up a container, where it throws an exception (that you can catch, which is great).

      dimage.withRun() { /* do nothing; just attempt to spin up container */ }
      

      The problem is that takes some time on a loaded server, because it spins up a container for no real reason.

      I would like a "validate" method. If that verb is too "heavy" and implies too much, "exists" would be fine, e.g.:

      dimage = docker.image("whatever/whatever:99")
      if (dimage.exists()) {
        ...
      }
      

      Workaround:

      image_id = sh (script: "docker images -q whatever/whatever:99", returnStdout: true).trim()
      if (image_id.isEmpty()) throw new Exception("Image not found")
      

            Assignee:
            Unassigned
            Reporter:
            Aaron D. Marasco
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: