buildx: ERROR: failed to solve: process "/bin/sh

Contributing guidelines

I’ve found a bug and checked that …

  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

Hi,

i am getting an error with buildx only. When running the same Dockerfile with docker build it works fine.

Expected behaviour

The image should build.

Actual behaviour

The image doesn’t build.

Buildx version

github.com/docker/buildx v0.11.2 9872040b6626fb7d87ef7296fd5b832e8cc2ad17

Docker info

Client: Docker Engine - Community
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.20.2
    Path:     /Users/groebroeck/.docker/cli-plugins/docker-compose

Server:
 Containers: 21
  Running: 1
  Paused: 0
  Stopped: 20
 Images: 128
 Server Version: 20.10.20
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
 init version: 
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.15.82-0-virt
 Operating System: Alpine Linux v3.16
 OSType: linux
 Architecture: aarch64
 CPUs: 2
 Total Memory: 1.93GiB
 Name: colima
 ID: 767Q:HZTI:3O2Y:ZSL5:PA2I:7ZE7:JE3N:RFPW:RIY6:7YAV:LRRU:XJH5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Builders list

NAME/NODE         DRIVER/ENDPOINT                              STATUS  BUILDKIT        PLATFORMS
hopeful_wright *  docker-container                                                     
  hopeful_wright0 unix:///Users/groebroeck/.colima/docker.sock running v0.11.6         linux/arm64, linux/amd64, linux/amd64/v2
colima            docker                                                               
  colima          colima                                       running v0.8.2+c0149372 linux/arm64, linux/amd64
default           docker                                                               
  default         default                                      running v0.8.2+c0149372 linux/arm64, linux/amd64

Configuration

FROM eclipse-temurin:19-jre as builder
ARG JAR=komga-1.3.0.jar
COPY assembly/* /
RUN java -Djarmode=layertools -jar ${JAR} extract

FROM eclipse-temurin:19-jre
# Install libjxl on x64 only. Homebrew is not available on other architectures.
RUN if [ "`uname -m`" = "x86_64" ]; then \
    apt -y update && \
    apt -y install git gcc && \
    NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
    brew install jpeg-xl; fi

VOLUME /tmp
VOLUME /config
WORKDIR app
COPY --from=builder dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder application/ ./
ENV KOMGA_CONFIGDIR="/config"
ENV LC_ALL=en_US.UTF-8
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/home/linuxbrew/.linuxbrew/lib/"
ENTRYPOINT ["java", "--enable-preview", "--enable-native-access=ALL-UNNAMED", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:/config/"]
EXPOSE 25600
LABEL org.opencontainers.image.source="https://github.com/gotson/komga"

Build logs

docker-buildx  build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --no-cache  --file Dockerfile .                       Thu Aug  3 18:36:31 2023
[+] Building 2.0s (12/33)                                                                                                                                                           docker-container:hopeful_wright
 => [internal] load build definition from Dockerfile                                                                                                                                                           0.0s
 => => transferring dockerfile: 1.18kB                                                                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                                                                0.0s
 => [linux/amd64 internal] load metadata for docker.io/library/eclipse-temurin:19-jre                                                                                                                          1.7s
 => [linux/arm64 internal] load metadata for docker.io/library/eclipse-temurin:19-jre                                                                                                                          1.7s
 => [linux/arm/v7 internal] load metadata for docker.io/library/eclipse-temurin:19-jre                                                                                                                         1.7s
 => CACHED [linux/arm/v7 stage-1 1/7] FROM docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                    0.0s
 => => resolve docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                                                0.0s
 => CANCELED [internal] load build context                                                                                                                                                                     0.2s
 => => transferring context: 3.74MB                                                                                                                                                                            0.1s
 => CACHED [linux/amd64 builder 1/3] FROM docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                     0.0s
 => => resolve docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                                                0.0s
 => CACHED [linux/arm64 stage-1 1/7] FROM docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                     0.0s
 => => resolve docker.io/library/eclipse-temurin:19-jre@sha256:e7934eaf29182fa4f883e4cc28a127fdd70e652f8208d3c8dc4edc3bfc92fb49                                                                                0.0s
 => ERROR [linux/arm/v7 stage-1 2/7] RUN if [ "`uname -m`" = "x86_64" ]; then     apt -y update &&     apt -y install git gcc &&     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubuserconten  0.1s
 => [linux/arm64 stage-1 2/7] RUN if [ "`uname -m`" = "x86_64" ]; then     apt -y update &&     apt -y install git gcc &&     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/H  0.2s
 => CANCELED [linux/amd64 stage-1 2/7] RUN if [ "`uname -m`" = "x86_64" ]; then     apt -y update &&     apt -y install git gcc &&     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercont  0.2s
------                                                                                                                                                                                                              
 > [linux/arm/v7 stage-1 2/7] RUN if [ "`uname -m`" = "x86_64" ]; then     apt -y update &&     apt -y install git gcc &&     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" &&     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" &&     brew install jpeg-xl; fi:
0.117 exec /bin/sh: exec format error
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:8
--------------------
   7 |     # Install libjxl on x64 only. Homebrew is not available on other architectures.
   8 | >>> RUN if [ "`uname -m`" = "x86_64" ]; then \
   9 | >>>     apt -y update && \
  10 | >>>     apt -y install git gcc && \
  11 | >>>     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
  12 | >>>     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
  13 | >>>     brew install jpeg-xl; fi
  14 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ \"`uname -m`\" = \"x86_64\" ]; then     apt -y update &&     apt -y install git gcc &&     NONINTERACTIVE=1 /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\" &&     eval \"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\" &&     brew install jpeg-xl; fi" did not complete successfully: exit code: 1


### Additional info

_No response_

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 22 (7 by maintainers)

Most upvoted comments

Same here. With version 0.11.2 I started seeing a bunch of ERROR: failed to solve: process "/bin/sh -c .... Reverted back to 0.11.0 and everything started working again

Looks like you forgot to install emulators: https://docs.docker.com/build/building/multi-platform/

$ docker run --privileged --rm tonistiigi/binfmt --install all

I will give it a spin, but the issue I had also happened on github actions with docker setup buildx

Also it used to work a few weeks ago.