-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Kaniko finds a Dockerfile in CWD ahead of one in the context #1381
Comments
I'm not sure if it's related, but if I change |
@TBBle Thank you for bringing this to our attention. Our docs can definitely get some more love. Agreed, it is confusing. do you ideas to make it better? |
My assumption is that a Dockerfile can't ../ to outside the context. So what's not clear to me, is That said, it's beside-the-point for this bug report, except that when I tried it as a fix, it actually made things worse. |
Hmm, why is this "kind/question"? It's intended to be a bug-report. Or is this behaviour Works-as-intended, and it's just the documentation doesn't mention the CWD at all? |
I've noticed this as well, and I agree that both Some examples of the issue with the default
What would I expect when using those flags:
so if |
two years later, |
I just got bit by this. It is almost 4 years since the original post. |
+1 |
1 similar comment
+1 |
Actual behavior
Given a filesystem layout, e.g. a Git checkout:
When the CWD is /workspace/, the following command, e.g., when using Kaniko under GitLab CI,
executes using /workspace/Dockerfile in context /workspace/subproject/.
Expected behavior
The build should use /workspace/subproject/Dockerfile in context /workspace/subproject/
To Reproduce
Additional Information
The problem appears to be that the code that resolves a DockerFile accidentally succeeds by checking for CWD-relative Dockerfile before checking context-relative Dockerfile. It probably needs to be a little smarter than that, checking a context-relative path for Dockerfile names that don't start with
.
or contain..
, and then fall back to CWD-relative.The README doesn't mention the behaviour of checking CWD-relative for Dockerfile, as it describes the context as the source of the Dockerfile.
I suspect this issue has fallen through the cracks because all the examples in the README.md of build-from-filesystem use absolute
--dockerfile
parameters, and clearly the primary Kaniko workflow is to build with the context pointing at something other than the filesystem.Triage Notes for the Maintainers
--cache
flagIs the
--cache
question here supposed to be "only seen" or "also seen"? My live repro uses--cache
, but the minimal repro here uses--no-push
so I can't use--cache
.The text was updated successfully, but these errors were encountered: