Hi! I'm building docker images with pants via dock...
# general
f
Hi! I'm building docker images with pants via docker buildkit, because I'm utilizing the
--cache-from
and
--cache-to
functionalities. But the images built this way don't play nicely with our
GitLab
container registry. When they are pushed, they seem not to contain any metadata. This is because buildkit has newer format of the metadata. I am able to solve this outside of pants, in two ways: • By passing
--provenance=false
flag directly to
docker buildx build
command. • By setting
BUILDX_NO_DEFAULT_ATTESTATIONS=1
environmental variable. I can't get this to work with pants though. I tried setting the
BUILDX_NO_DEFAULT_ATTESTATIONS
both in the shell where I build, as well as putting this to
.pants.bootstrap
file. Does anyone have an idea if this is supposed to work with pants somehow?
w
I used to be a lot more well-versed with this, but I don't really use Docker much anymore. However, there are a variety of places where env vars can be set - so maybe it's just in the incorrect location? What about on the docker block? https://www.pantsbuild.org/stable/docs/docker#docker-configuration
The other suggestion would be to find where the docker command happens in code, and then try to see how it uses args/env vars
f
Thanks a lot for the hints! The first hint did it. So, putting this env var under
[docker].env_vars
in
pants.toml
file.
🎉 1
So:
Copy code
[docker]
env_vars = [
    "BUILDX_NO_DEFAULT_ATTESTATIONS=1"
]