Bug: Docker Multistage Build labeled stage is not detected
See original GitHub issueDescription
Mutlistage Docker Build is failing if named stage is used as a base later:
Info
- docker-maven-plugin version: 0.34.1
- maven verison: 3.6.3
Example Dockerfile:
FROM centos AS first
RUN ls -la /
FROM centos as second
RUN ls -la /
# this fails
FROM second
RUN ls -la /
Error:
Failed to execute goal io.fabric8:docker-maven-plugin:0.34.1:build (build-docker) on project xxx-my-project-xxx Unable to pull 'second:latest' : {"message":"pull access denied for second, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"} (Not Found: 404)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Issue with Docker multi-stage builds - Stack Overflow
I have an issue with a multi-stage build where the binary that is being built in stage one is properly copied to stage...
Read more >A Guide to Docker Multi-Stage Builds | by Bhargav Bachina
In this article, we will see how we can build images efficiently with Docker multi-stage builds and also we will explore what are...
Read more >Copying files in multistage docker pipeline fails | Bitbucket Cloud
I get the following error when trying to copy files from a previous build stage. #!generic Step 7/18 : COPY --from=uikit /app/binders-ui-kit.tgz /app...
Read more >Multi-stage builds - Docker Documentation
The following command assumes you are using the previous Dockerfile but stops at the stage named builder : $ docker build --target builder...
Read more >Faster Multi-Platform Builds: Dockerfile Cross-Compilation ...
The most common pattern to use in multi-stage builds is to define a build stage(s) where we prepare our build artifacts and a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I agree with this report: the plugin fails because it attempts to pull any
FROM
image regardless of it being a named image (usingFROM ... AS <name>
) declared upstream in a multi-stage build. This is actually a regression because it was previously working with version 0.28.0.A simple project exhibiting the issue is attached to ease reproducing the issue: maven-docker-plugin-fails-with-named-build-stages.tar.gz
Trying to narrow the problem down shows that building with plugin version 0.28.0 passes with flying color when it fails quick & hard with plugin version 0.29.0.
Scanning through the 0.29.0 changelog hints that pull request #1057 is probably the culprit: instead of attempting to pull the first base image only, it attempts to do so with each and every base image (declared with
FROM
) without checking that the image may be a reference to an already declared and named build stage if it does not declare an alias on itself (found after investigation).Forking now and checking what can be done.