rules_docker icon indicating copy to clipboard operation
rules_docker copied to clipboard

Can't build containers on macOS after upgrade to 0.23.0

Open eikemeier opened this issue 3 years ago • 10 comments

🐞 bug report

Affected Rule

The issue is caused by the rule: java_image

Is this a regression?

Yes, the previous version in which this bug was not present was: 0.22.0

Description

When building a simple Java Docker image on macOS, the build fails with “No matching toolchains found”. It works on Linux, since the target and host platforms are identical.

🔬 Minimal Reproduction

See https://github.com/eikemeier/java-container

🔥 Exception or Error


bazel build //src/main/java/com/example/hello_world:hello_world_image
[...]
ERROR: [...]/java-container/src/main/java/com/example/hello_world/BUILD:16:11: While resolving toolchains for target //src/main/java/com/example/hello_world:hello_world_image.binary: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. [...]

🌍 Your Environment

Operating System:

  
macOS Catalina 10.15.7
  

Output of bazel version:

  
5.0.0
  

Rules_docker version:

  
0.23.0
  

Anything else relevant?

See also https://github.com/bazelbuild/rules_docker/issues/1988#issuecomment-1016465174

eikemeier avatar Jan 28 '22 10:01 eikemeier

Same for go_image; 0.22.0 works, 0.23.0 doesn't. According to git bisect, seems to be introduced in: Transition container image target platform (#1963) 76c708fc979c1bfb65b4db300c654be08f096874

dragonsinth avatar Feb 04 '22 20:02 dragonsinth

Same for py3_image, 0.22.0 works and 0.23.0 doesn't. Hopefully this can be fixed soon :)

pcmoritz avatar Feb 27 '22 20:02 pcmoritz

Is anyone looking into this issue? Any workaround other than going back to 0.22?

psalaberria002 avatar Mar 22 '22 08:03 psalaberria002

We've had to prepare a cross-compiling C toolchain to use on macOS in order to make this work. Ultimately, we picked one based on musl, since that's most likely to work on most linux variants, but we've also had to patch rules_go to force go_binary to statically link when building for a docker image. Getting this working properly has been a pretty significant piece of work.

If anyone is following in our footsteps, we started off from musl-cross-make

shs96c avatar Mar 24 '22 17:03 shs96c

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

github-actions[bot] avatar Sep 21 '22 04:09 github-actions[bot]

I don't think this is closable, I'm still locked to 0.22 waiting on a fix for this.

kylekurz avatar Sep 21 '22 14:09 kylekurz

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

github-actions[bot] avatar Mar 22 '23 02:03 github-actions[bot]

As before, this is still an unaddressed issue and should not be closed.

kylekurz avatar Mar 22 '23 13:03 kylekurz

With py3_image, for 0.25 we are still having this problem.

trungdinhth avatar Jun 28 '23 09:06 trungdinhth