docker / docs

Source repo for Docker's Documentation
https://docs.docker.com
Apache License 2.0
4.13k stars 7.15k forks source link

VOLUME statement behavior in legacy builder vs. BuildKit #18113

Open nathanweeks opened 1 year ago

nathanweeks commented 1 year ago

Is this a docs issue?

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?

docker-robot[bot] commented 6 months ago

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

nathanweeks commented 6 months ago

/remove-lifecycle stale

docker-robot[bot] commented 3 months ago

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

nathanweeks commented 3 months ago

/remove-lifecycle stale

docker-robot[bot] commented 3 days ago

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

nathanweeks commented 3 days ago

/remove-lifecycle stale