-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Base image metadata (manifest and container configuration) is pulled for every build #1881
Comments
It appears that JIB will use the cached entry without contacting the registry if Maven is run with the "-o" flag. Unfortunately this does not work with the "jib:build" target as mustBeOnline overrides this. I would suggest changing this logic. |
As tags like |
Created #1884 as Jib should make it easy to find out the base image digest too |
Thank you for clarifying. I'll look into the digest option, but we still would like the "latest" tag - we just don't want as frequent checking. I appreciate opinonated software as it usually makes configuration and usage much easier, but the best tools are the ones which can be used in ways not envisioned by the original authors. I think that a possible, backwards compatible solution could be that the check also looks at the timestamps of the metadata files and if "not older than X" seconds is considered "new enough" without needing to check the origin. This is what Maven does and can be overridden with the "-U" flag. X should then be configurable in the pom, and overridable from the command line. What do you think? |
Just to clarify, the digest option to not do an up-to-date check is what we decided to implement (i.e., it does the check every time now whether using a tag or a digest). One question to understand your use case and motivation clearly: why s it that you are so averse to make a couple more network calls? Checking a manifest is really cheap. For About the "not older than X seconds" check, I think it makes sense for Maven because everything Maven caches is immutable, but that strategy is not a good fit in this case. |
I am not against making a network call. The target repository is "nearby" and inside the coorporate firewall so that is fine. The source repository, however, may not be, which is to my understanding why a cache is even in place in the first place (otherwise you could just download the image everytime you need it). Essentially we would like for our builds to be as independent of network resources as possible. You implicitly require the internet to be available at all times, if using e.g. an image on dockerhub. |
Oh, I see. So I get that the concern is not really about suppressing a couple more network calls, but essentially that
I left a comment on Gitter too, but leaving the basically same here just in case you missed it: Assuming I understood it right, here's one suggestion that I actually think might be the best solution in your situation where your primary goal is to achieve the isolation and network independence to the extent you described above: in this case, I think you should really put the base image into your internal registry behind your corporate firewall. That way, you can make your builds as independent of network resources as possible; just the private source/target registry in this case. Moreover, I think it has a few more advantages which I think you are also seeking at the same time: you'll have a total control over how to pin down your base image and when to update at your will. But looks like your primary objective is to reduce network source dependence as much as possible, so I think that alone already warranties using an internal repository to store base images and may actually be the best solution. What do you think of this suggestion? |
@m86194 what registry do you use? JFrog Artifactory for example, make a "gateway" between your internal and internet network. You can configure remote repositories, you know? The only thing that you need open to internet is the Artifactory server. In this example: you need a java-minimal imagem to dockerhub. You can call this: |
We have a Nexus instance running which should be able to be used as a Docker proxy, but I have not yet had time to look into making this work. |
Huum .. |
Hi, I maintain this plugin https://github.com/fabric8io/fabric8-maven-plugin and we're trying to add an option to build images using JIb as a daemon-less option. For our case, If the user is looking to just build a tarball, he shouldn't be dependent on an internet connection. |
@dev-gaur try running the build with |
@dev-gaur oh, for jib-core, I believe there is an API where you can set the offline mode. |
Oh, Awesome! Thank you. |
@m86194 We just released 1.7.0, which will not pull the manifest on every build if you specify the base image with a digest. |
Environment:
Description of the issue:
We would like for JIB to only consult the registry containing the from-image, if that image is not already cached. Currently it appears that this happens for each and every build (probably to see if the image has been updated). For our purposes we are fine with just populating the cache once, and then use that entry for the lifetime of the instance (pod). If we need updating, we just restart the pod.
Expected behavior:
Registry containing from-image is only contacted at all if image is not cached. If cached, no network traffic should happen. This can emulated with a VERY long timeout before trying to refresh a cache entry.
This should be settable as a pom-entry, and overridable from the command line.
Steps to reproduce:
Any build. For our proof-of-concept build, we use "adoptopenjdk/openjdk11:slim" as the from image.
jib-maven-plugin
Configuration:Additional Information:
The text was updated successfully, but these errors were encountered: