-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile: validate order when linking stages #4568
Conversation
c627ab6
to
227feea
Compare
Nice! This will be easier to grasp. This test seems to fail after this change when using implicit from?:
|
20526af
to
7c7f841
Compare
Dockerfile stages always needed to be in order (you can not refer to a stage that is defined after your current command), but the behavior for incorrect order was undefined instead of consistently erroring. Previously copying from a stage defined later would usually cause an error about a missing source file that could have been quite confusing. When the source path was "/" then the behavior could have been worse and resulted in COPY passing without error, without any files actually being copied (or only images from base image being copied). This validates the order when on COPY and mount dispatch, returns proper error with correct source code location. Signed-off-by: Tonis Tiigi <[email protected]>
7c7f841
to
0615bb4
Compare
This appears to have broken using a command like this in a base image:
When building the image referencing the base image, the error is Pinning the Dockerfile referencing the base image to |
Dockerfile stages always needed to be in order (you can not refer to a stage that is defined after your current command), but the behavior for incorrect order was undefined instead of consistently erroring.
Previously copying from a stage defined later would usually cause an error about a missing source file that could have been quite confusing. When the source path was "/" then the behavior could have been worse and resulted in COPY passing without error, without any files actually being copied (or only files from base image being copied).
This validates the order when on COPY and mount dispatch, returns proper error with correct source code location.