[BUG] inconsistencies with VOLUME between docker buildx and docker build
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
Hi,
I post my issue here after posting the same in docker compose https://github.com/docker/compose/issues/10231
I got an inconsistency issue between docker build and docker buildx build.
Here is my Dockerfile
FROM alpine
VOLUME /foo
RUN chmod -R 700 /foo
And here is the output of the docker build command
$ sudo docker build -t foo .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine
latest: Pulling from library/alpine
8921db27df28: Already exists
Digest: sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a
Status: Downloaded newer image for alpine:latest
---> 042a816809aa
Step 2/3 : VOLUME /foo
---> Running in 90eab3d387d9
Removing intermediate container 90eab3d387d9
---> c128568a1f07
Step 3/3 : RUN chmod -R 700 /foo
---> Running in 68b24de61af7
Removing intermediate container 68b24de61af7
---> 38510c0ffa7c
Successfully built 38510c0ffa7c
Successfully tagged foo:latest
And here is the output of docker buildx build command
$ sudo docker buildx build -t foo .
[+] Building 1.0s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.5s
=> CACHED [1/2] FROM docker.io/library/alpine@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a 0.0s
=> => resolve docker.io/library/alpine@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a 0.0s
=> ERROR [2/2] RUN chmod -R 700 /foo 0.4s
------
> [2/2] RUN chmod -R 700 /foo:
#0 0.350 chmod: /foo: No such file or directory
------
ERROR: failed to solve: executor failed running [/bin/sh -c chmod -R 700 /foo]: exit code: 1
Here is my versions
$ sudo docker version
Client:
Version: 20.10.23
API version: 1.41
Go version: go1.19.5
Git commit: 715524332f
Built: Sat Jan 21 15:13:25 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.12)
Go version: go1.19.5
Git commit: 6051f14291
Built: Sat Jan 21 15:12:19 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.16
GitCommit: 31aa4358a36870b21a992d3ad2bef29e1d693bec.m
runc:
Version: 1.1.4
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$ sudo docker buildx version
github.com/docker/buildx 0.10.0 876462897612d36679153c3414f7689626251501
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Dockerfile containing VOLUME /foo and reproduce the difference between docker build and docker buildx build. Compare how the two commands execute the RUN chmod step after VOLUME; done when the documented Dockerfile produces consistent behavior in both build paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100