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

Kaniko creates more layers than Docker #313

Closed
lubo opened this issue Aug 25, 2018 · 1 comment · Fixed by #334
Closed

Kaniko creates more layers than Docker #313

lubo opened this issue Aug 25, 2018 · 1 comment · Fixed by #334
Labels
kind/bug Something isn't working

Comments

@lubo
Copy link

lubo commented Aug 25, 2018

When using VOLUME Dockerfile instruction, Kaniko creates a new layer, which contains only the directories specified in VOLUME instruction. Docker does not create those directories in the image at all.

@priyawadhwa priyawadhwa added the kind/bug Something isn't working label Aug 27, 2018
@peter-evans
Copy link
Contributor

peter-evans commented Sep 4, 2018

This issue was interesting to me so I had a quick look at Kaniko's code and it looks like a snapshot of the file system is taken with each layer it builds. If the snapshot contains data it adds a layer. The VOLUME command is creating directories and so the layer has "content."

If Docker doesn't add a layer with the VOLUME command, where does that info get stored in the final container image? Presumably it's written to the image somewhere and the directories are created when the container starts.

EDIT: Answering my own question. Config is written to the image. https://github.com/GoogleContainerTools/kaniko/blob/master/pkg/executor/build.go#L149
So I wonder if this could be fixed by simply not creating the directories in VOLUME layers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants