Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] docker-compose build isn't functioning with Docker 25.0.x, throwing the error: "unrecognized option '--keep'" #11551

Closed
ilfat12 opened this issue Feb 27, 2024 · 4 comments
Labels

Comments

@ilfat12
Copy link

ilfat12 commented Feb 27, 2024

Description

After updating to docker 25.0.3 from docker 24.0.9 docker-compose build stopped working with the following error:

admin@server ~/test $ sudo docker-compose up -d --build
Пароль:
[+] Building 2.4s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                     0.0s
 => => transferring dockerfile: 88B                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                         1.9s
 => [internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                          0.0s
 => [1/2] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                                                   0.5s
 => => resolve docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                                                   0.0s
 => => sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b 1.64kB / 1.64kB                                                                                           0.0s
 => => sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0 528B / 528B                                                                                               0.0s
 => => sha256:05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd 1.47kB / 1.47kB                                                                                           0.0s
 => => sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 3.41MB / 3.41MB                                                                                           0.4s
 => => extracting sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8                                                                                                0.1s
 => ERROR [2/2] RUN apk add git                                                                                                                                                          0.0s
------
 > [2/2] RUN apk add git:
#4 0.018 run: unrecognized option '--keep'
#4 0.018 Try `run --help' or `run --usage' for more information.
------
failed to solve: process "/bin/sh -c apk add git" did not complete successfully: exit code: 64

Steps To Reproduce

~/test/docker-compose.yml:

version: "3"
services:
  app:
    build: .

~/test/Dockerfile:

FROM alpine
RUN apk add git

run from the ~/test directory: docker-compose up -d --build or docker-compose build

Compose Version

Docker Compose version 2.24.6

Docker Environment

Client:
 Version:    25.0.3
 Context:    default
 Debug Mode: false

Server:
 Containers: 16
  Running: 16
  Paused: 0
  Stopped: 0
 Images: 42
 Server Version: 25.0.3
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1677a17964311325ed1c31e2c0a3589ce6d5c30d
 runc version: 1.8.5-1
 init version:
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.58-generic-1rosa2021.1-x86_64
 Operating System: ROSA Fresh Server 12.4
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 31.13GiB
 Name: server
 ID: 51c9ed54-6fb7-42f5-9fdf-29520c0f407d
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: API is accessible on http://127.0.0.1:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/go/attack-surface/

Anything else?

No response

@jhrotko
Copy link
Contributor

jhrotko commented Feb 27, 2024

Hello @ilfat12,

I was trying to reproduce your issue with no success. But also I was not using sudo. Is it required to use sudo in your case?
Could you also try:

  • without the sudo?
  • docker buildx build . (inside ~/test)
  • docker compose build
    Let me know what happens

@ilfat12
Copy link
Author

ilfat12 commented Feb 28, 2024

Hello @jhrotko

  • docker buildx build .
admin@server ~/test $ docker buildx build .
[+] Building 0.4s (5/5) FINISHED                                                                                                                                                                      docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                            0.0s
 => => transferring dockerfile: 65B                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                                                 0.0s
 => CACHED [1/2] FROM docker.io/library/alpine:latest                                                                                                                                                           0.0s
 => ERROR [2/2] RUN apk add git                                                                                                                                                                                 0.3s
------
 > [2/2] RUN apk add git:
0.078 run: unrecognized option '--keep'
0.078 Try `run --help' or `run --usage' for more information.
------
Dockerfile:2
--------------------
   1 |     FROM alpine
   2 | >>> RUN apk add git
   3 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apk add git" did not complete successfully: exit code: 64
  • docker compose build
admin@server ~/test $ docker compose build
[+] Building 0.3s (5/5) FINISHED                                                                                                                                                                      docker:default
 => [app internal] load build definition from Dockerfile                                                                                                                                                        0.0s
 => => transferring dockerfile: 65B                                                                                                                                                                             0.0s
 => [app internal] load metadata for docker.io/library/alpine:latest                                                                                                                                            0.0s
 => [app internal] load .dockerignore                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                 0.0s
 => CACHED [app 1/2] FROM docker.io/library/alpine:latest                                                                                                                                                       0.0s
 => ERROR [app 2/2] RUN apk add git                                                                                                                                                                             0.2s
------
 > [app 2/2] RUN apk add git:
0.069 run: unrecognized option '--keep'
0.069 Try `run --help' or `run --usage' for more information.
------
failed to solve: process "/bin/sh -c apk add git" did not complete successfully: exit code: 64

@ilfat12
Copy link
Author

ilfat12 commented Feb 28, 2024

If I remove buildx, the legacy builder builds the image but docker-compose continues to throw an error.

admin@server ~/test $ docker builder build --no-cache .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM alpine
 ---> 05455a08881e
Step 2/2 : RUN apk add git
 ---> Running in cf921049aad4
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
(1/10) Installing ca-certificates (20230506-r0)
(2/10) Installing brotli-libs (1.1.0-r1)
(3/10) Installing c-ares (1.24.0-r1)
(4/10) Installing libunistring (1.1-r2)
(5/10) Installing libidn2 (2.3.4-r4)
(6/10) Installing nghttp2-libs (1.58.0-r0)
(7/10) Installing libcurl (8.5.0-r0)
(8/10) Installing libexpat (2.6.0-r0)
(9/10) Installing pcre2 (10.42-r2)
(10/10) Installing git (2.43.0-r0)
Executing busybox-1.36.1-r15.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 18 MiB in 25 packages
 ---> Removed intermediate container cf921049aad4
 ---> 717cf091021b
Successfully built 717cf091021b

When I created the issue I didn't have buildx installed, so the legacy docker builder worked and I thought the problem was with docker-compose. But now it's clear that the problem is not with it.

@ilfat12 ilfat12 closed this as completed Feb 28, 2024
@ilfat12
Copy link
Author

ilfat12 commented Mar 1, 2024

containers/crun#1428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants