best-furniture-15331
05/08/2023, 9:03 PMBuildKit is enabled but the buildx component is missing or broken.
Install the buildx component to build images with BuildKit:
<https://docs.docker.com/go/buildx/>
Notes:
• I’m on an Intel-chip Macbook
• I installed the most recent Docker Desktop
• With --keep-sandboxes=on_failure
, I can run the __run.sh
and the docker build succeeds with DOCKER_BUILDKIT=1
(and the image appears in my docker desktop)
It seems like my Docker installation is able to build with BuildKit enabled, but when running through Pants it doesn’t detect buildx?
I’m new to Pants, so any direction would very appreciated! Let me know what other information I can provide.
Thanks!curved-television-6568
05/08/2023, 9:17 PMDOCKER_BUILDKIT
to your pants.toml
in order for it to propagate to the docker build command, or did you provide that when you ran __run.sh
?curved-television-6568
05/08/2023, 9:18 PMHOME
set as well.. or something like that.best-furniture-15331
05/08/2023, 9:25 PM[docker]
env_vars = ["DOCKER_BUILDKIT=1", ...]
best-furniture-15331
05/08/2023, 9:36 PMDOCKER_BUILDKIT=0
, I get this error:
2023-05-08 11:14:26 Failed to find compatible interpreter on path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
2023-05-08 11:14:26
2023-05-08 11:14:26 Examined the following interpreters:
2023-05-08 11:14:26 1.) /usr/local/bin/python3.9 CPython==3.9.16
2023-05-08 11:14:26 2.) /usr/bin/python3.9 CPython==3.9.2
2023-05-08 11:14:26
2023-05-08 11:14:26 No interpreter compatible with the requested constraints was found:
2023-05-08 11:14:26
2023-05-08 11:14:26 A distribution for apache-beam could not be resolved for /usr/local/bin/python3.9.
2023-05-08 11:14:26 Found 1 distribution for apache-beam that do not apply:
2023-05-08 11:14:26 1.) The wheel tags for apache-beam 2.44.0 are cp39-cp39-macosx_10_9_x86_64 which do not match the supported tags of /usr/local/bin/python3.9:
2023-05-08 11:14:26 cp39-cp39-manylinux_2_31_x86_64
2023-05-08 11:14:26 ... 661 more ...
A couple questions regarding this:
1. Where are these paths coming from (e.g. /usr/local/bin/python3.9
)--this does not exist on my system; is this referring to paths inside the docker image?
2. Why is it selecting macosx_10_9_x86_64
? When I check my sysinfo from various python paths on my mac, I get macosx-10.9-universal2
best-furniture-15331
05/09/2023, 4:54 PMcurved-television-6568
05/09/2023, 6:46 PMbest-furniture-15331
05/09/2023, 7:22 PMbest-furniture-15331
05/10/2023, 8:54 PM./pants run Dockerfile
fails with BuildKit is enabled but the buildx component is missing or broken
(no image is created),
BUT when I go to the sandbox and run __run.sh
(which runs docker build
), the image builds successfully?
Maybe relevant:
Even though __run.sh
successfully creates an image, subsequently running docker run
on that image gives Failed to find compatible interpreter on path
, which is the same error I get with DOCKER_BUILDKIT=0 ./pants run Dockerfile
(mentioned above)
Thanks for the help!curved-television-6568
05/10/2023, 8:57 PM__run.sh
script you get in the sandbox is Pants best approximation of what it does when invoking that process. So if that works while Pants fails, there’s some little nuanced difference between the two, likely env var related.curved-television-6568
05/10/2023, 9:00 PMbest-furniture-15331
05/12/2023, 10:48 PMdocker_environment
! 🎉
BUT…. I’m still running into this BuildKit/buildx issue 😕
Running pants run Dockerfile
still gives the incessant BuildKit is enabled but the buildx component is missing or broken.
error, despite definitely having buildx on my system, installed via Docker Desktop, and confirmed in docker info
.
Further, both of the following methods successfully build the docker image:
1. Run the __run.sh
in the pants sandbox
2. Run my own bash script with all necessary pants package
commands and docker build
I cannot figure out why pants run Dockerfile
is failing to detect buildx, while the other 2 approaches build the image without issue. Any guidance is greatly appreciated!
Note: pants run Dockerfile
does succeed if I set DOCKER_BUILDKIT=0
in [docker].env_vars
broad-processor-92400
05/13/2023, 5:33 AM__run.sh
isn’t yet fully hermetic (ie doesn’t fully simulate running within pants itself ) and may be leaking some env vars from your shell. Does running env
in a shell reveal any potentially docker relevant env vars?best-furniture-15331
05/15/2023, 4:42 PMcurved-television-6568
05/15/2023, 5:11 PM-i
flag: env -i …
that way, you get the same hermeticity as Pants.curved-television-6568
05/15/2023, 5:11 PM__run.sh
scriptbest-furniture-15331
05/22/2023, 8:05 PMenv -i
tip! Using that, I found that it was indeed the HOME env var getting passed that allowed docker build to succeed when running ./__run.sh
curved-television-6568
05/23/2023, 1:44 PMenv -i
flag will be provided in the __run.sh
script already. https://github.com/pantsbuild/pants/pull/18582best-furniture-15331
05/23/2023, 4:14 PM__run.sh
will fully reproduce the hermiticity of pants?