-
Notifications
You must be signed in to change notification settings - Fork 4
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
Nesting several Dockerfiles using Relative FROM breaks relative paths #13
Comments
This is an expected behavior, the relative path is relative to the dockerfile itself. Only the root dockerfile is relative to the build context. From the documentation:
|
If you really need to use the build context in the include path, we could think as a kind of variable or something like |
@devthejo wouldn't it ease the project usage if all relative FROM/INCLUDE paths were always from the context folder? Thanks a lot for this!! |
I think it would be more intuitive if all relative FROM/INCLUDE paths were resolved from the calling file, but limitations on buildkit doesn't not allow this for the entry point Dockerfile. |
Hi!
Thank you for this project.
I have problems when I try to separate my build to several stages using Relative FROM. It seems like that this feature cause relative path corruption when there are more than one Relative FROM in dockerfiles chain
How to reproduce
Project structure:
Dockerfile.stage1:
Dockerfile.stage2:
Dockerfile.stage3:
Execute:
When I run stage1 and stage2 builds it works fine:
docker build -f dockerfiles/Dockerfile.stage1 .
docker build -f dockerfiles/Dockerfile.stage2 .
But stage3 build exits with error:
docker build -f dockerfiles/Dockerfile.stage3 .
Output:
Problem
Seems like first Relative FROM in chain change cwd for next Relative FROMs
Expected behaviour:
Relative FROM always works relative to build context
The text was updated successfully, but these errors were encountered: