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

jibDockerBuild:multi-platform image building not supported when pushing to Docker engine #3692

Closed
machaleb opened this issue Jun 15, 2022 · 9 comments

Comments

@machaleb
Copy link

Environment:

  • com.google.cloud.tools.jib: 3.2.1
  • Gradle 7.3.3
  • OS: Linux 4.18.0-348.23.1.el8_5.x86_64 amd64
  • JVM: 17.0.3 (Azul Systems, Inc. 17.0.3+7-LTS

Description of the issue:
When trying to build multi-arch image for amd64 and s390x platform using jibDockerBuild it gives error as below

* What went wrong:
Execution failed for task ':jibDockerBuild'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: multi-platform image building not supported when pushing to Docker engine

Expected behavior:
It should build the image using command ./gradlew jibDockerBuild

Steps to reproduce:

jib-maven-plugin Configuration:

PASTE YOUR pom.xml CONFIGURATION HERE

jib-gradle-plugin Configuration:

[root@flexible1 helloworld]# cat build.gradle
plugins {
  id 'java'
  id 'com.google.cloud.tools.jib' version '3.2.1'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  mavenCentral()
}

dependencies {
  implementation 'com.google.guava:guava:23.6-jre'
}

jib.from {
  image = 'nginx'
  platforms {
    platform {
      architecture = 'amd64'
      os = 'linux'
    }
    platform {
      architecture = 's390x'
      os = 'linux'
    }
  }
}

jib.to {
  image = 'bhagyashrimachale/helloworld:v2'
  auth {
    username = 'bhagyashrimachale'
    password = '*********************'
  }
}

Log output:

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :jibDockerBuild

Containerizing application to Docker daemon as bhagyashrimachale/helloworld:v2...
Base image 'nginx' does not use a specific image digest - build may not be reproducible
The base image requires auth. Trying again for nginx...
Using base image with digest: sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514

Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, example.HelloWorld]

Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, example.HelloWorld]

Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, example.HelloWorld]

Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, example.HelloWorld]
Executing tasks:
[========================      ] 80.0% complete
> building image to Docker daemon


> Task :jibDockerBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jibDockerBuild'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: multi-platform image building not supported when pushing to Docker engine

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 45s
3 actionable tasks: 3 executed

Additional Information:
I am able to build the image using ./gradlew jib but my requirement is to build it using ./gradlew jibDockerBuild

@chanseokoh
Copy link
Member

This is a duplicate of #2743. And it's unclear if the Docker daemon supports storing images of different architectures.

@machaleb
Copy link
Author

@chanseokoh I saw the issue which you referred but it is bit unclear. with docker buildx we can build mutli-platform image using docker buildx build --platform linux/amd64,linux/s390x . How we can do using jibDockerBuild ?
jibDockerBuild is not having same feature as docker buildx?

@chanseokoh
Copy link
Member

chanseokoh commented Jun 15, 2022

According to the following comments

docker buildx build --platform (with multiple platforms specified) doesn't seem to support pushing to a Docker engine either, which is the same situation with jibDockerBuild.

And your feature request is #2743, so I assure you this is a dup.

@elefeint
Copy link
Contributor

Closing as duplicate.

@elefeint elefeint closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2022
@machaleb
Copy link
Author

Closing this issue as docker engine doesn't support multiplatform manifest when pushing to it.
@chanseokoh thanks for explanation .

@abluepoint-dev
Copy link

abluepoint-dev commented Feb 9, 2023

use jib:build instand of jib:dockerBuild

@MilanObrenovic
Copy link

auth

solved it for me. thanks. seems like jibDockerBuild only builds a local docker image out of the spring boot app. but jib builds the image and pushes to docker hub, and also somehow works on multi platform.

@clembo590
Copy link

use jib:build instand of jib:dockerBuild

this is not a good option as it will build and push the images

@alexanderankin
Copy link

alexanderankin commented Jun 15, 2024

this has been fixed, see #2743 (comment)

in the sense that you can use the jib docker task while multiplatform configuration exists, it picks the correct local platform and uses it.

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

7 participants