https://pantsbuild.org/ logo
#general
Title
# general
h

happy-family-315

02/17/2023, 1:21 PM
Hi, I was trying to build a docker target and I am getting the following error:
Copy code
#3 [internal] load metadata for <http://docker.io/library/python:3.8-buster|docker.io/library/python:3.8-buster>
#3 sha256:88586e40fdfcc6826fc75a7a9653c2727184be908b30c80bf7580390d6713f00
#3 ERROR: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-dev-containers-e0fbf732d956a2c0412935aab1cc18ff0f3b4638": executable file not found in $PATH, out: ``
It fails here:
FROM python:3-8-buster
I don't understand why this happens because using
docker build
works fine. (I am running this inside a devcontainer)
s

sparse-lifeguard-95737

02/17/2023, 2:17 PM
by default, Pants will run the
docker build
process in a sandbox with most environment variables un-set - this can cause problems when the docker CLI tries to locate & run plugins
I hit similar problems with the ECR auth problem. one sec while I dig up the config that fixed it
so at the minimum, in
pants.toml
you’ll need to specify:
Copy code
[docker]
tools = ["docker-credential-dev-containers-e0fbf732d956a2c0412935aab1cc18ff0f3b4638"]
that will make sure the binary is on the
PATH
in the sandbox
I’m not sure if that sha at the end of the path is constant 🤔 if it’s not, you’ll need to do something trickier / more dynamic
i.e. in
.pants.bootstrap
in your repo root, write shell to: 1.
find
the
docker-credential-dev-containers-*
binary to get its actual full name 2.
export PANTS_DOCKER_TOOLS="+['$the_full_path']"
we use a similar dynamic-lookup trick to conditionally inject
aws-oidc
into our docker tool list
you might also need to add
HOME
to
[docker].env_vars
in
pants.toml
- something in my team’s docker stack was using it to look up configs, but I don’t remember if it was the core CLI or one of our plugins
h

happy-family-315

02/21/2023, 11:14 AM
Thanks but this does not seem to work currently. I do not understand why I am unable to build docker images with pants. It worked before so am I doing something wrong. I think your setup should be unnecessary because it should work out of the box.
p

prehistoric-afternoon-67621

02/21/2023, 2:06 PM
@happy-family-315 This is not a nuanced answer but I've solved this by
rm ~/.docker/config.json
and trying the build again 🙈
19 Views