Skip to content
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

clear file mount stubs and fix empty layer cases #1739

Merged
merged 4 commits into from
Oct 20, 2020

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Oct 19, 2020

Fixes moby/moby#38667 by removing the empty files that were created for the mountpoints. Otherwise, paths used for secrets or /etc/resolv.conf would remain in the image as empty files.

While testing with the fix I discovered cases where empty layers were not handled properly for cache export. Extra commits fix these cases. After that, the example case in #1727 now produces reproducible digests.

Copy link
Collaborator

@coryb coryb left a comment

Choose a reason for hiding this comment

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

LGTM, one minor nit

executor/stubs.go Outdated Show resolved Hide resolved
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@casdevs
Copy link

casdevs commented Dec 22, 2020

could this patch be extended to also cover directory mounts?

currently, when using

RUN --mount=from=builder,source=/tmp/package/,target=/tmp/package/,rw ...

we're left with an empty stub dir /tmp/package/ in the final docker image

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.

--secret flag leaves traces of the mounted secret file in an image
4 participants