Open gbhushan86 opened 1 year ago
So the /etc/resolv.conf
, /etc/hostname
and /etc/hosts
files (with the default bridge network at least) are managed files, and mounted into the container, so it's worth noting that;
/etc
; was there a specific reason for that? (there's quite some files under that path, changing permissions means those files will be duplicated into a new layer)That said, it looks like BuildKit mounts those read-only (whereas the legacy builder does allow them to be modified);
Without Buildkit:
DOCKER_BUILDKIT=0 docker build --no-cache -<<'EOF'
FROM alpine
RUN mount | grep /etc
EOF
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM alpine
---> 042a816809aa
Step 2/2 : RUN mount | grep /etc
---> Running in 4439f724c5b4
/dev/vda1 on /etc/resolv.conf type ext4 (rw,relatime,data=ordered)
/dev/vda1 on /etc/hostname type ext4 (rw,relatime,data=ordered)
/dev/vda1 on /etc/hosts type ext4 (rw,relatime,data=ordered)
With BuildKit:
DOCKER_BUILDKIT=1 docker build --no-cache --progress=plain -<<'EOF'
FROM alpine
RUN mount | grep /etc
EOF
moby/moby#5 [2/2] RUN mount | grep /etc
moby/moby#5 sha256:6a771f791ee459e50e92baa65f3ca068473cf1f9191b6ff6a5f488b2378ba88e
moby/moby#5 0.194 /dev/vda1 on /etc/resolv.conf type ext4 (ro,nosuid,nodev,noexec,relatime)
moby/moby#5 0.194 /dev/vda1 on /etc/hosts type ext4 (ro,nosuid,nodev,noexec,relatime)
moby/moby#5 DONE 0.2s
Let me transfer this to the BuildKit repository, as changing this would require changes in that repository (but it's possible this was by design).
So the
/etc/resolv.conf
,/etc/hostname
and/etc/hosts
files (with the default bridge network at least) are managed files, and mounted into the container, so it's worth noting that;
- changes in permissions of those files won't persist in the image (as they're bind-mounted when a container is started from them)
- I do notice that you're recursively changing all files in
/etc
; was there a specific reason for that? (there's quite some files under that path, changing permissions means those files will be duplicated into a new layer)That said, it looks like BuildKit mounts those read-only (whereas the legacy builder does allow them to be modified);
Without Buildkit:
DOCKER_BUILDKIT=0 docker build --no-cache -<<'EOF' FROM alpine RUN mount | grep /etc EOF Sending build context to Docker daemon 2.048kB Step 1/2 : FROM alpine ---> 042a816809aa Step 2/2 : RUN mount | grep /etc ---> Running in 4439f724c5b4 /dev/vda1 on /etc/resolv.conf type ext4 (rw,relatime,data=ordered) /dev/vda1 on /etc/hostname type ext4 (rw,relatime,data=ordered) /dev/vda1 on /etc/hosts type ext4 (rw,relatime,data=ordered)
With BuildKit:
DOCKER_BUILDKIT=1 docker build --no-cache --progress=plain -<<'EOF' FROM alpine RUN mount | grep /etc EOF moby/moby#5 [2/2] RUN mount | grep /etc moby/moby#5 sha256:6a771f791ee459e50e92baa65f3ca068473cf1f9191b6ff6a5f488b2378ba88e moby/moby#5 0.194 /dev/vda1 on /etc/resolv.conf type ext4 (ro,nosuid,nodev,noexec,relatime) moby/moby#5 0.194 /dev/vda1 on /etc/hosts type ext4 (ro,nosuid,nodev,noexec,relatime) moby/moby#5 DONE 0.2s
Since its a container we dont want other users to touch or tweak any files inside /etc so why..
Description
Hi All, IM trying to build image in Docker Desktop v20.10.17 using Buildkit=true.
Below is the Docker File
While running the command while enabling buildkit Im receiving the following error.
While keeping buildkit as false im able to build Image.But as per requirement I need buildkit to build image processing.
Reproduce
Expected behavior
Buildkit should build image without any errors
docker version
docker info
Additional Info
No response