VOLUME statement behavior in legacy builder vs. BuildKit
Is this a docs issue?
- [X] My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
The "Notes about specifying volumes" section mentions
- Changing the volume from within the Dockerfile: If any build steps change the data within the volume after it has been declared, those changes will be discarded.
This is apparently true for the legacy builder, but not for BuildKit (https://github.com/moby/moby/issues/37176#issuecomment-470951814):
BuildKit has a slightly different behaviour, where VOLUME statements are not applied during build, so it will actually modify the files that were originally in the given location, and only attach a volume when the container is run.
Location
https://docs.docker.com/engine/reference/builder/
Suggestion
Perhaps note the difference in behavior between the legacy builder and BuildKit?
There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment.
If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.
Prevent issues from auto-closing with a /lifecycle frozen comment.
/lifecycle stale
/remove-lifecycle stale