Skip to content

Clarify .dockerignore usage in README #1341

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

npwolf
Copy link

@npwolf npwolf commented Mar 27, 2025

The previous instructions made me think mutation of the .dockerignore file was not supported with the git context, but the the basic .dockerignore was supported (not the case). Just trying to improve the doc so it is more clear.

@crazy-max crazy-max self-assigned this Mar 28, 2025
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the the basic .dockerignore was supported (not the case)

Not sure I understand this statement. Do you mean .dockerignore file within a Git context is supported?

@@ -81,7 +81,7 @@ jobs:
```

Be careful because **any file mutation in the steps that precede the build step
will be ignored, including processing of the `.dockerignore` file** since
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is already self-explanatory that .dockerignore is ignored with Git context here. We also say that Path context should be used in next sentence if you don't want this behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazy-max I personally thought the text was saying file mutations in general and file mutations of the .dockerignore file specifically weren't supported with git context (not that .dockerignore wasn't supported at all in git context). I've updated this with another revision to try to improve the clarity for others. Let me know if I can improve it further. If you don't feel it warrants an update, feel free to close the PR. Thanks!

@mschoettle
Copy link
Contributor

I have a Dockerfile that expects .git to be present. So I ran into this issue with the git vs path context. Once I found the relevant part in the README the explanation there was clear to me.

The problem I had is that I looked in the wrong place of the README (the examples section). So maybe we could add a link to this part of the README in the examples section?

@crazy-max
Copy link
Member

I have a Dockerfile that expects .git to be present. So I ran into this issue with the git vs path context. Once I found the relevant part in the README the explanation there was clear to me.

The problem I had is that I looked in the wrong place of the README (the examples section). So maybe we could add a link to this part of the README in the examples section?

You can keep the .git folder with Git context if you set the build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1: https://docs.docker.com/reference/dockerfile/#buildkit-built-in-build-args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants