-
Notifications
You must be signed in to change notification settings - Fork 651
Open
Description
When a Dockerfile contains a COPY --from=my-registry.example.com/some-image ... statement and the some-image is not available locally, the build with docker-maven-plugin version 0.45.1 will fail due to missing authentication with the following error message:
Unable to build image [my-image] : "invalid from flag value my-registry.example.com/some-image: Head \"https://my-registry.example.com/v2/some-image/manifests/latest\": no basic auth credentials" ["invalid from flag value my-registry.example.com/some-image: Head \"https://my-registry.example.com/v2/some-image/manifests/latest\": no basic auth credentials" ]
Workaround: Pull the desired image via FROM my-registry.example.com/some-image AS workaround before the COPY --from=workaround ... statement. (Keep in mind that this introduces a multi-stage build, so be careful where to place ARG statements.)
For example:
# Workaround to pull the image with credentials
FROM my-registry.example.com/some-image AS workaround
# Actual base image for my build
FROM my-registry.example.com/base-image
ARG MY_ARG=42
# "COPY --from=my-registry.example.com/some-image src target" would also work here because the image has already been pulled.
COPY --from=workaround src target
or (if you want to keep the workaround closer to its usage)
ARG MY_ARG=42
# Actual base image for my build
FROM my-registry.example.com/base-image AS base
# Restate ARG for multi-stage build
ARG MY_ARG
# Do other stuff ...
# ...
# Workaround to pull the image with credentials
FROM my-registry.example.com/some-image AS workaround
# Switch back to actual base image of my build
FROM base
# Restate ARG for multi-stage build
ARG MY_ARG
COPY --from=workaround src target
rmontag-ap
Metadata
Metadata
Assignees
Labels
No labels