-
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
Support creation of Docker tags #654
Comments
Thanks for the feedback. Tags are just human-readable aliases for an image. Your image already exists in your repository, so it is just a matter of attaching another tag (alias) to your image in the repository. That said, although Jib could potentially add this feature, I feel this fairly trivial operation is actually out of scope of Jib and should be done at the repository side. For example, https://cloud.google.com/container-registry/docs/managing#tagging_images and https://docs.aws.amazon.com/AmazonECR/latest/userguide/retag-aws-cli.html. |
True indeed - The point would be to decrease the number of tools required to build and therefore make Jib more attractive. If this would be supported, more people could do without Docker, Gcloud or whatever in the build. |
Hi @az82 , in Jib, you can actually push the same image with a different tag (just change the |
I still see the point of delivering an image which was already built to Registry X, retag it and then push it to Registry Y. I really went through a lot of docs now and it seems that jib only supports multiple tagging during the gradle build. But in my case the build container which runs in kubernetes is just a temporary provisioned gradle Deamon. So let’s say t some stage my snapshot image from development needs to be tagged and delivered to some Registry Y, it’s simply not possible. |
Hi @gluehbirnenkopf,
Sorry, I didn't get it. Are you saying there is an already built and published image in Registry X and you simply want to "copy" that image to Registry Y, without running Gradle or Jib? Are you basically suggesting a separate CLI tool that'll do the copy? |
@chanseokoh Example: |
If there would be a way to achieve this with jib, perfect! Otherwise I need to look in different toolings. |
Hi @gluehbirnenkopf , this seems like a use case that is outside the scope of Jib, since Jib is intended to be just a container builder for Java. For a standalone tool to copy remote images, I would recommend If you'd like to copy an image as part of your Gradle build, you could use Jib Core: // Imports Jib Core as a library to use in this build script.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:jib-core:0.1.1'
}
}
import com.google.cloud.tools.jib.api.Jib
import com.google.cloud.tools.jib.api.Containerizer
import com.google.cloud.tools.jib.api.RegistryImage
import com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory
import com.google.cloud.tools.jib.image.ImageReference
// 'jibcopy' copies a container image from `sourceImage` to `targetImage`.
task('jibcopy') {
doLast {
def sourceImage = '<source image reference>'
def targetImage = '<target image reference>'
Jib
// Starts with the existing image.
.from(sourceImage)
// Performs the containerization.
.containerize(
Containerizer.to(
// Tells Jib to containerize to targetImage's registry.
RegistryImage
.named(targetImage)
// Tells Jib to get registry credentials from a Docker config.
.addCredentialRetriever(
CredentialRetrieverFactory
.forImage(ImageReference.parse(targetImage))
.dockerConfig())))
}
} |
@coollog This is valueable input. I will dive into jib core right after checking crane. |
Description of the issue:
The Jib Gradle/Maven plugins should support the creation of Docker tags without building a new image. This is important for promotion workflows where an image gains new tags while being promoted through the stages.
Expected behavior:
Something like the command below creates a tag in the repository
repo
:The text was updated successfully, but these errors were encountered: