Skip to content

[Bug]: container build fails to resolve local images in COPY --from #1240

Description

@ivankra

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

cat >Dockerfile.base <<'EOF'
FROM alpine:latest
RUN echo hello >/hello.txt
EOF

cat >Dockerfile.test <<'EOF'
FROM alpine:latest
COPY --from=bug-base /hello.txt /copied.txt
RUN cat /copied.txt
EOF

container build -t bug-base -f Dockerfile.base .
container build -t bug-test -f Dockerfile.test .

Current behavior

It tries to pull a non-existent image from docker.io rather then using a local image.

Expected behavior

COPY --from=<tag> should use a local image with that tag first if available, just like FROM <tag> does.

Environment

- OS: macOS 26.2
- Xcode: i don't use it
- Container: container CLI version 0.9.0 (build: release, commit: 3e49dce)

Relevant log output

+ container build -t bug-base -f Dockerfile.base .
[+] Building 4.0s (5/5) FINISHED
 => [resolver] fetching image...docker.io/library/alpine:latest                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                          0.0s
 => oci-layout://docker.io/library/alpine:latest@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659                                 0.0s
 => => resolve docker.io/library/alpine:latest@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659                                   0.0s
 => CACHED [linux/arm64 1/2] RUN echo hello >/hello.txt                                                                                                  0.0s
 => exporting to oci image format                                                                                                                        0.0s
 => => exporting layers                                                                                                                                  0.0s
 => => exporting manifest sha256:fad670ed74832a71f87d6cdf26a2083bce90651dddee35c328790f43532cb8da                                                        0.0s
 => => exporting config sha256:b8376d1efdb7f2b30e0bdc3f227b751fab323fcf0c81628505262d580d24a6f0                                                          0.0s
 => => exporting manifest list sha256:9891ae92d2f8a70aedcf316a926307c075ce319f4411c6f5eaedf5a885703271                                                   0.0s
 => => sending tarball                                                                                                                                   0.0s
Successfully built bug-base:latest
+ container build -t bug-test -f Dockerfile.test .
[+] Building 0.0s (0/1)
 => [resolver] fetching image...docker.io/library/alpine:latest                                                                                          0.0s
Error: internalError: "HTTP request to https://registry-1.docker.io/v2/library/bug-base/manifests/latest failed with response: 401 Unauthorized. Reason: Unknown, no credentials found for host registry-1.docker.io"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions