dockerdockerfiledocker-imageamazon-ecrdocker-tag

Docker trying to pull non-existent image from dockerhub when Image exists locally


Total docker newbie here and I would appreciate any help I could get. I pulled an image from my ECR repository and tagged it as app:latest using this command: docker tag xxxxxxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/app app:latest. When I list my imaged with docker images, the image is there with the new tag.

REPOSITORY                                                TAG                                                                          IMAGE ID       CREATED         SIZE
xxxxxxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/app          latest                                              b5c8c2b74272   4 weeks ago     660MB
app                                                       latest                                                                       b5c8c2b74272   4 weeks ago     660MB

I want to use this app:latest image as the base image in my Dockerfile. I know docker's default behavior is to check locally for the image and pull from dockerhub if it's not stored locally. When I run docker build -t hello ., I get this error:

[+] Building 1.3s (4/4) FINISHED                                                
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 36B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => ERROR [internal] load metadata for docker.io/library/app:latest        1.2s
 => [auth] library/app:pull token for registry-1.docker.io                 0.0s
------
 > [internal] load metadata for docker.io/library/app:latest:
------
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 

Why is docker trying to pull from dockerhub when the app:latest image exists locally? Any insights would be greatly appreciated. Thank you!


Solution

  • I think this issue is related to me using an M1 computer. I ran these commands and I was able to successfully build my docker image from my Dockerfile

    export DOCKER_BUILDKIT=0
    export COMPOSE_DOCKER_CLI_BUILD=0