Closed adrianovieira closed 1 year ago
I'm not able to reproduce this error, docker compose build
is able to build your Dockerfile
Can you please confirm you can build with buildkit? run docker buildx build .
docker buildx build
$ docker buildx build
docker: 'buildx' is not a docker command.
Seems you don't have a correct docker installation (missing buildx plugin) how did you installed?
On Fedora there is the moby-engine
package, dnf install ...:
moby-engine-20.10.21-1.fc37.x86_64
docker-compose-plugin-2.14.1-3.fc37.x86_64
and
curl -SL https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64 \
-o /usr/local/bin/docker-compose
ok, so that's not the official docker installation package (https://docs.docker.com/engine/install/fedora/) and your docker cli is still using the "classic" builder. You can force compose to do the same by setting DOCKER_BUIKDKIT=0
environment variable
ok, so that's not the official docker installation package (https://docs.docker.com/engine/install/fedora/) and your docker cli is still using the "classic" builder. You can force compose to do the same by setting
DOCKER_BUIKDKIT=0
environment variable
Yes!
The DOCKER_BUILDKIT=0
workaround solved the issue.
Thank you.
Closing as "Can't reproduce"
Please, let me share some information for those who are using moby-engine
+ docker-compose-2.14
as I am.
vagrant init -m fedora/37-cloud-base
vagrant up
vagrant ssh -c "sudo dnf install -y moby-engine"
vagrant ssh -c "sudo systemctl start docker"
vagrant ssh -c "sudo curl -SL https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose"
vagrant ssh -c "sudo chmod +x /usr/local/bin/docker-compose"
vagrant ssh -c "sudo docker version"
vagrant ssh -c "docker-compose version"
vagrant ssh -c 'sudo echo -e "FROM python:3.10\nRUN apt-get update && apt-get install -y --no-install-recommends postgresql-client tzdata && rm -rf /var/lib/apt/lists/*\n" > Dockerfile'
vagrant ssh -c 'sudo echo -e "version: \"3\"\nservices:\n myapp:\n image: myapp\n build:\n context: ./\n dockerfile: Dockerfile" > docker-compose.yml'
# And now lets build the image
## this docker-compose will not work
vagrant ssh -c "sudo docker-compose build"
## the DOCKER_BUILDKIT=0 workaround allow it to build the image
vagrant ssh -c "sudo DOCKER_BUILDKIT=0 docker-compose build"
Have fun
thanks, will try to reproduce
I ran suggested vagrant VM and was able to reproduce this bug Then installed buildx (https://github.com/docker/buildx/releases/tag/v0.9.1) .. and same error applies:
$ sudo buildx build .
[+] Building 2.3s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 237B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.10 0.7s
=> CACHED [1/2] FROM docker.io/library/python:3.10@sha256:b4b8149f2ff93c993d9b752dd4298493975e341a6b542a33cd 0.0s
=> ERROR [2/2] RUN apt-get update && apt-get install -y --no-install-recommends postgresql-client tzdata && 1.2s
------
> [2/2] RUN apt-get update && apt-get install -y --no-install-recommends postgresql-client tzdata && rm -rf /var/lib/apt/lists/*:
#0 1.109 exec /bin/sh: permission denied
I wonder moby-engine
comes with a well configured buildkit daemon. This should be reported to buildx maintainers
@crazy-max is this a know issue with Fedora ?
Can confirm the issue. Using selinux on Fedora Linux 36. Just updated and rebooted to use latest moby-engine 20.10.12-3.fc3 (which provides docker).
Using a simple build based on debian:bookworm which uses some basic shell commands which all fail since it can't even execute the shell (/bin/sh
). The same file runs fine with docker-compose build
.
This is most definitely some selinux specific problem. Running sudo setenforce 0
fixes the issue. So a temporary workaround seems to run that during the build-phase and change it back to 1
afterwards.
I think I was using docker-compose 2.6.0 or 2.9.0. I updated to 2.15.0 which had the same issue.
I'm not sure if I built some images when last updating docker-compose a while back. I suspect this might be an issue caused by a never version of docker or some other fedora packages related to selinux (not docker-compose itself). Maybe some rule fixed it for docker specifically but not for docker-compose.
docker-compose build --no-cache
while selinux is enforcingI already ran a suggested command (by selinux logs) which might have fixed one of the errors already: sudo setsebool -P domain_can_mmap_files 1
I also changed the shell to bash and env. Neither works which suggests that the build env for some reason isn't allowed by selinux to execute any executables at all.
Also changed the context of my docker-compose file to the same as docker (didn't solve it either):
$ ls -lahZ /usr/bin/docker
-rwxr-xr-x. 1 root root system_u:object_r:container_runtime_exec_t:s0 43M Dec 20 18:15 /usr/bin/docker
$ sudo chcon system_u:object_r:container_runtime_exec_t:s0 /usr/local/bin/docker-compose
$ ls -lahZ /usr/local/bin/docker-compose
-rwxr-xr-x. 1 root root system_u:object_r:container_runtime_exec_t:s0 43M Jan 5 10:13 /usr/local/bin/docker-compose
I hope this can help.
Description
I do can build using the
docker build --no-cache -t myapp ./
command.But
docker-compose build
does not work and I get the errors below:Steps To Reproduce
create the
Dockerfile
:create the
docker-compose.yml
:run
docker build --no-cache -t myapp ./
: works like a charmrun
docker-compose build
: but it does not work - neither trying it after thedocker build ...
command aboveCompose Version
Docker Environment
Anything else?
No response