Skip to content

Conversation

@holdenk
Copy link
Contributor

@holdenk holdenk commented May 22, 2020

What changes were proposed in this pull request?

Add cross build support to our docker image script using the new dockerx extension.

Why are the changes needed?

We have a CI for Spark on ARM, we should support building images for ARM and AMD64.

Does this PR introduce any user-facing change?

Yes, a new flag is added to the docker image build script to cross-build

How was this patch tested?

Manually ran build script & pushed to https://hub.docker.com/repository/registry-1.docker.io/holdenk/spark/tags?page=1 verified amd64 & arm64 listed.

@holdenk holdenk changed the title [SPARK-31778] Support cross-building docker images [SPARK-31778][K8S][BUILD] Support cross-building docker images May 22, 2020
@SparkQA
Copy link

SparkQA commented May 22, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27656/

@SparkQA
Copy link

SparkQA commented May 22, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27656/

@SparkQA
Copy link

SparkQA commented May 22, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27657/

@SparkQA
Copy link

SparkQA commented May 22, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27657/

@SparkQA
Copy link

SparkQA commented May 22, 2020

Test build #123013 has finished for PR 28615 at commit f7fdddc.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 22, 2020

Test build #123014 has finished for PR 28615 at commit ea0769d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work on Docker Desktop. I tested on the latest one, Docker Desktop Edge 2020-05-20 2.3.1.0. In this case, we had better describe the limitation of this new feature. Could you describe the used and expected environment in your PR description?

$ bin/docker-image-tool.sh -r docker.io/myrepo -t v3.0.0 -X -b java_image_tag=11-jre-slim build
...
+ docker buildx build --platform linux/amd64,linux/arm64 --build-arg java_image_tag=11-jre-slim -t docker.io/myrepo/spark:v3.0.0 -f kubernetes/dockerfiles/spark/Dockerfile .
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")

@holdenk
Copy link
Contributor Author

holdenk commented May 24, 2020

It does work on docker desktop but you need to be setup to cross build (currently experimental). I'll add a link in the script for those instructions.

@SparkQA
Copy link

SparkQA commented May 25, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27705/

@SparkQA
Copy link

SparkQA commented May 25, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/27705/

@SparkQA
Copy link

SparkQA commented May 25, 2020

Test build #123068 has finished for PR 28615 at commit e5176c7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented May 25, 2020

Thank you for updating. Given the new URL at the last commit, it seems that this feature is pretty immature. Can we wait until it become stable?

BTW, I've also been in experimental mode as described in the doc, but the situation is the same. If this is not working at out-of-box status, the single URL looks insufficient to support this PR.

$ cat ~/.docker/config.json | grep experimental
  "experimental" : "enabled",

@holdenk
Copy link
Contributor Author

holdenk commented May 25, 2020

Cross building is relatively new, but a lot of docker images are cross built already. It’s optional and disabled by default (eg to have this build you’d have to explicitly configure it).

For example the JDK11 base image is already cross built on amd64 and aarm64.

You need to follow the buildx setup instructions not just turn on the expiremental channel.

@dongjoon-hyun dongjoon-hyun self-requested a review May 25, 2020 04:42
@dongjoon-hyun
Copy link
Member

Okay. I removed my previous change request.
I'll leave this to the other reviewers then. Thanks.

@dongjoon-hyun dongjoon-hyun dismissed their stale review May 25, 2020 04:44

I removed my previous comment.

@dongjoon-hyun dongjoon-hyun removed their request for review May 25, 2020 04:45
@asfgit asfgit closed this in 2570228 Jun 2, 2020
asfgit pushed a commit that referenced this pull request Jun 2, 2020
### What changes were proposed in this pull request?

Add cross build support to our docker image script using the new dockerx extension.

### Why are the changes needed?

We have a CI for Spark on ARM, we should support building images for ARM and AMD64.

### Does this PR introduce _any_ user-facing change?

Yes, a new flag is added to the docker image build script to cross-build

### How was this patch tested?
Manually ran build script & pushed to https://hub.docker.com/repository/registry-1.docker.io/holdenk/spark/tags?page=1 verified amd64 & arm64 listed.

Closes #28615 from holdenk/cross-build.

Lead-authored-by: Holden Karau <[email protected]>
Co-authored-by: Holden Karau <[email protected]>
Signed-off-by: Holden Karau <[email protected]>
(cherry picked from commit 2570228)
Signed-off-by: Holden Karau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants