Hi <@U01PZK60W2F> - I'm back with another (hopeful...
# general
f
Hi @curved-television-6568 - I'm back with another (hopefully interesting) pants docker issue, was hoping you could help me debug. This is a bit of a weird one. I have a "python base" image which has a pretty standard target:
Copy code
docker_image(
    name="python_base",
    source="python/Dockerfile",
    registries=["base_images"],
    repository="python",
    image_tags=["internal_build"],
    skip_push=True
)
So this builds and tags
base_images/python_base:internal_build
, and other docker_image targets have it as a pants dependency, and their dockerfiles start with
FROM base_images/python_base:internal_build
. All of this worked, until I switched the python_base's source image, from
FROM ubuntu:20.04
to
FROM amd64/ubuntu:20.04
(I'm building on an M1 mac, and trying to force x86 virtualization in my images). Pants can still build python_base, but it can't build any images that depend on it, instead, docker tries to pull the image from docker.io:
Copy code
#3 [internal] load metadata for <http://docker.io/base_images/python:internal_build|docker.io/base_images/python:internal_build>
#3 sha256:658dd15cabbf2cf418526dfa6c6ce44508d99eec32bbad5dcc6be686cbc57fe2
#3 ERROR: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
------
 > [internal] load metadata for <http://docker.io/base_images/python:internal_build|docker.io/base_images/python:internal_build>:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
However, I see can the image on my system:
Copy code
> docker image ls | grep base_images/python
base_images/python                internal_build                       438b7f434621   54 minutes ago   328MB
And I can build the image that depends on base_images/python using a standard
docker build
command, it has no problem finding the image. Any idea where I could look next?
If I could use the
platform
build parameter, that would also solve my problem - though I'm curious if you have any insight, I have no idea why it's behaving this way.
c
Hi! :) My understanding of image platforms are still a bit hazy. Though, have you tried using
FROM —platform=… base/image
if that makes any difference..?
Support for the platform parameter is definitely a feature we want to have, eventually
My guess at why it behaves this way would be that the platform you build for doesn't match the platforms supported by the amd64/ubuntu image perhaps 🤔. Will take another look in the morning.
f
Thanks @curved-television-6568 - I just hit the same issue using the docker cli, after I had moved on to some other development work, with all my changes reverted back to baseline - so it can't be a pants issue. I think this is a docker bug related to some kind of caching issue - https://forums.docker.com/t/not-finding-local-unprefixed-docker-image-in-the-local-cache/113297 and https://github.com/docker/for-mac/issues/5419. Your suggestion of using
FROM -platform=
appears to fix that issue, too. So, thank you!
🙌 1
c
OK, thanks for the feedback. Great that you managed to find a way around the issue. 🙂
❤️ 1