Skip to content

how to buid image using base image on local repo #301

@ishii1648

Description

@ishii1648

I want to build image for another cpu architecture (build image for arm64 on x86 ).
When base image is hosted on dokcer.io, I success to build image.
But when base image is only hosted on local repository, I fail to build image.

Can I build image using base image on local repository?
If so, could you tell me how to build?

base image(ubuntu:18.04) is hosted on dokcer.io -> success

$ cat Dockerfile
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y curl
WORKDIR /src
COPY . .
$ docker buildx build --platform linux/arm/v7 -t test-buildx --load . 
[+] Building 117.9s (10/10) FINISHED                                                                                                
 => [internal] load build definition from Dockerfile                                                                           0.1s
 => => transferring dockerfile: 123B                                                                                           0.0s
 => [internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 2B                                                                                                0.0s
 => [internal] load metadata for docker.io/library/ubuntu:18.04                                                                3.3s
 => CACHED [1/4] FROM docker.io/library/ubuntu:18.04@sha256:3235326357dfb65f1781dbc4df3b834546d8bf914e82cce58e6e6b676e23ce8f   0.0s
 => => resolve docker.io/library/ubuntu:18.04@sha256:3235326357dfb65f1781dbc4df3b834546d8bf914e82cce58e6e6b676e23ce8f          0.0s
 => [internal] load build context                                                                                              0.0s
 => => transferring context: 123B                                                                                              0.0s
 => [2/4] RUN apt-get update && apt-get install -y curl                                                                      106.1s
 => [3/4] WORKDIR /src                                                                                                         0.1s
 => [4/4] COPY . .                                                                                                             0.0s
 => exporting to oci image format                                                                                              5.8s 
 => => exporting layers                                                                                                        3.0s 
 => => exporting manifest sha256:5b17b05614a3bc56d041b2b9c20287809a4d991c7eb5aea5edd967fa6d606d44                              0.0s 
 => => exporting config sha256:43053f0e59e955c21680843e3f75da89ef2729901a6e4b0d6ddd8b2525543c08                                0.0s 
 => => sending tarball                                                                                                         2.7s
 => importing to docker 
$ docker images | grep test-build
test-buildx                   latest              43053f0e59e9        About a minute ago   82.1MB

base image(test-buildx) is only hosted on local repository -> fail

$ cat Dockerfile
FROM test-buildx:latest
RUN apt-get update && apt-get install -y curl
WORKDIR /src
COPY . .
$ docker buildx build --platform linux/arm/v7 -t test-buildx2 --load .                                     
[+] Building 6.7s (5/8)                                                                                                             
 => [internal] load build definition from Dockerfile                                                                           0.0s
 => => transferring dockerfile: 129B                                                                                           0.0s
 => [internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 2B                                                                                                0.0s
 => ERROR [internal] load metadata for docker.io/library/test-buildx:latest                                                    3.4s
 => ERROR [1/4] FROM docker.io/library/test-buildx:latest                                                                      3.3s
 => => resolve docker.io/library/test-buildx:latest                                                                            3.3s
 => [internal] load build context                                                                                              0.0s
 => => transferring context: 129B                                                                                              0.0s
------
 > [internal] load metadata for docker.io/library/test-buildx:latest:
------
------
 > [1/4] FROM docker.io/library/test-buildx:latest:
------
failed to solve: rpc error: code = Unknown desc = failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions