You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compare to running docker build with and without DOCKER_BUILDKIT.
$ DOCKER_BUILDKIT=1 docker build .
[+] Building 0.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 36B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:latest 0.0s
=> CACHED [1/2] FROM docker.io/library/ubuntu 0.0s
=> ERROR [2/2] RUN echo "127.0.0.1 test.localhost" >> /etc/hosts 0.2s
------
> [2/2] RUN echo "127.0.0.1 test.localhost" >> /etc/hosts:
#5 0.233 /bin/sh: 1: cannot create /etc/hosts: Read-only file system
------
executor failed running [/bin/sh -c echo "127.0.0.1 test.localhost" >> /etc/hosts]: exit code: 2
$ DOCKER_BUILDKIT=0 docker build .
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM ubuntu
---> fb52e22af1b0
Step 2/2 : RUN echo "127.0.0.1 test.localhost" >> /etc/hosts
---> Using cache
---> ea73e60b789f
Successfully built ea73e60b789f
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
$
Observed result
In step 3, note how running DOCKER_BUILDKIT=0 docker-compose build still results in a failed build because /etc/hosts is on a read-only filesystem.
In step 4, note how running DOCKER_BUILDKIT=0 docker build, the docker build succeeds because /etc/hosts isn't on a read-only filesystem.
Expected result
In step 3, running DOCKER_BUILDKIT=0 docker-compose build should result in a successful build.
I found out that when DOCKER_BUILDKIT=0, docker builds succeed by silently ignoring the change to the /etc/hosts file. I verified that the /etc/hosts file in the docker images do not have the test.localhost entries.
More detail about how the classic builder silently ignores the changes to /etc/hosts in moby/buildkit#1267 (comment)
Description of the issue
Context information (for bug reports)
docker compose ...
docker-compose ...
Output of
docker(-)compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant
-f
and other flags)Steps to reproduce the issue
docker-compose build
with and withoutDOCKER_BUILDKIT
.docker build
with and withoutDOCKER_BUILDKIT
.Observed result
In step 3, note how running
DOCKER_BUILDKIT=0 docker-compose build
still results in a failed build because /etc/hosts is on a read-only filesystem.In step 4, note how running
DOCKER_BUILDKIT=0 docker build
, the docker build succeeds because /etc/hosts isn't on a read-only filesystem.Expected result
In step 3, running
DOCKER_BUILDKIT=0 docker-compose build
should result in a successful build.Stacktrace / full error message
Additional information
OS version / distribution: macOS Big Sur version 11.6
docker-compose
install method: Docker Desktop version 4.0.1 (68347)The text was updated successfully, but these errors were encountered: