Jib: API support for TarImage push to registry

Created on 26 Oct 2019  路  8Comments  路  Source: GoogleContainerTools/jib

If I understand the Jib API (Containerizer) correctly, you can either:

  • Build the image: to(TarImage)
  • Build and push the image: to(RegistryImage)

But I do not find a way to push the built image (TarImage) - without a Docker daemon present. What I would love to see is API support for pushing a local image (tarball).

Use case

I am contributing to fabric8-maven-plugin, and Jib support was added to this plugin recently. I am trying to use this new feature now, and it does not work very well currently - at least not for me. 馃槥 I have been looking at the code, with the intention of preparing an improvement PR. A lot of minor improvements can be done, but one of the main challenges is that f-m-p separates building (fabric8:build) and pushing (fabric8:push) images. And that seems to be impossible to do with Jib Core a.t.m.....

Most helpful comment

Closing this issue as the suggestion from @TadCordle seems to work. Thanks!

All 8 comments

I think you may be able to use the built tar image as the base image, and then build a registry image without adding additional files. For example:

// Build
TarImage builtImage = TarImage.at(...).named(...);
Jib.from(...)
    // Add contents, etc....
    .containerize(Containerizer.to(builtImage));

// Push
Jib.from(builtImage).containerize(Containerizer.to(RegistryImage.named(...)));

@TadCordle : Really? That would be awsome! Thanks! I will give it a try and see if it works. Can we leave this issue open for a while - until I can verify your suggestion?

Hi @TadCordle, the caveat here is that the fabric8-maven-plugin has 2 distinct maven mojos/goals for Building a tar image locally and then pushing the tar image to the designated registry.

// Build
TarImage builtImage = TarImage.at(...).named(...);
Jib.from(...)
// Add contents, etc....
.containerize(Containerizer.to(builtImage));

// Push
Jib.from(builtImage).containerize(Containerizer.to(RegistryImage.named(...)));
```

Therefore, this continuity in the above code snippet can't be maintained.

We need a way to Built a TarImage object from a local tar file. Is any such operation possible?

Nevermind, I was on a older version where TarImage.at() doesn't exists.
:man_facepalming:

@dev-gaur : Can you please let us know if the suggestion from @TadCordle works in the context of f-m-p? So this issue can be closed?

hey @erikgb , it worked :)

Closing this issue as the suggestion from @TadCordle seems to work. Thanks!

Was this page helpful?
0 / 5 - 0 ratings