Open
Description
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
Documentation provides the following Dockerfile
[FROM] golang:latest
[WORKDIR] /app
[RUN] --mount=type=bind,target=. go build -o /app/hello
And claims
Only the output of the go build command remains.
In reality building such a Dockerfile will fail since the output of go build overlaps with the mount.
copying /tmp/go-build2793723972/b001/exe/a.out: open /app/hello: read-only file system
Location
https://docs.docker.com/build/cache/optimize/
Suggestion
Probably change
[WORKDIR] /build
and I suggest also mentions explecitely that using mount binds requires you to strictly create the build output outside of the mount bind, which is usually requires some changes.