Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API support for TarImage push to registry #2104

Closed
erikgb opened this issue Oct 26, 2019 · 8 comments
Closed

API support for TarImage push to registry #2104

erikgb opened this issue Oct 26, 2019 · 8 comments

Comments

@erikgb
Copy link

erikgb commented Oct 26, 2019

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.....

@TadCordle
Copy link
Contributor

TadCordle commented Oct 26, 2019

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(...)));

@erikgb
Copy link
Author

erikgb commented Oct 26, 2019

@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?

@devang-gaur
Copy link

devang-gaur commented Dec 2, 2019

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?

@devang-gaur
Copy link

Nevermind, I was on a older version where TarImage.at() doesn't exists.
🤦‍♂️

@erikgb
Copy link
Author

erikgb commented Dec 2, 2019

@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?

@devang-gaur
Copy link

hey @erikgb , it worked :)

@devang-gaur
Copy link

Watch out for this PR fabric8io/fabric8-maven-plugin#1766

@erikgb
Copy link
Author

erikgb commented Dec 4, 2019

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

@erikgb erikgb closed this as completed Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants