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 3 years ago
  • Reactions: 6
  • Comments: 26 (7 by maintainers)

Most upvoted comments

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

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

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.

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 had the same issue with M1 Mac and this one solved my problem! Thanks!

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

We had same issue on Windows10 + WSL(Ubuntu22.04) and this works. Thanks!

Hi - I’m running into this issue right now, trying to only build it with Github Actions (ubuntu-latest). It was working last year.

I updated the QEMU and all the other actions to the latest, but it’s still not working. Not using colima or anything like that, and none of the fixes proposed in this thread have worked.

logs workflow dockerfile

Specifically, failing with

#14 [linux/amd64  6/11] RUN echo "*** Install FFF ***" && 	set -x &&     if [ -z 4.30.0 ]; then 		echo "FFF Using Default Release";         python3 -m pip --no-cache-dir install FanFicFare;     else 		echo "FF Using 4.30.0 Release";         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==4.30.0;     fi
#14 0.213 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
#14 ERROR: process "/bin/sh -c echo \"*** Install FFF ***\" && \tset -x &&     if [ -z ${FFF_RELEASE} ]; then \t\techo \"FFF Using Default Release\";         python3 -m pip --no-cache-dir install FanFicFare;     else \t\techo \"FF Using ${FFF_RELEASE} Release\";         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==${FFF_RELEASE};     fi" did not complete successfully: exit code: 1

#9 [linux/arm64  2/11] RUN set -x &&     apt-get update &&     apt-get install -y --upgrade     bash     ca-certificates     gcc     wget     xdg-utils     curl     dbus 	jq 	python3
#9 CANCELED
------
 > [linux/amd64  6/11] RUN echo "*** Install FFF ***" && 	set -x &&     if [ -z 4.30.0 ]; then 		echo "FFF Using Default Release";         python3 -m pip --no-cache-dir install FanFicFare;     else 		echo "FF Using 4.30.0 Release";         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==4.30.0;     fi:
0.213 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile:56
--------------------
  55 |     
  56 | >>> RUN echo "*** Install FFF ***" && \
  57 | >>> 	set -x && \
  58 | >>>     if [ -z ${FFF_RELEASE} ]; then \
  59 | >>> 		echo "FFF Using Default Release"; \
  60 | >>>         python3 -m pip --no-cache-dir install FanFicFare; \
  61 | >>>     else \
  62 | >>> 		echo "FF Using ${FFF_RELEASE} Release"; \
  63 | >>>         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==${FFF_RELEASE}; \
  64 | >>>     fi
  65 |      RUN echo "*** Install Other Python Packages ***" && \
--------------------
ERROR: failed to solve: process "/bin/sh -c echo \"*** Install FFF ***\" && \tset -x &&     if [ -z ${FFF_RELEASE} ]; then \t\techo \"FFF Using Default Release\";         python3 -m pip --no-cache-dir install FanFicFare;     else \t\techo \"FF Using ${FFF_RELEASE} Release\";         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==${FFF_RELEASE};     fi" did not complete successfully: exit code: 1
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c echo \"*** Install FFF ***\" && \tset -x &&     if [ -z ${FFF_RELEASE} ]; then \t\techo \"FFF Using Default Release\";         python3 -m pip --no-cache-dir install FanFicFare;     else \t\techo \"FF Using ${FFF_RELEASE} Release\";         python3 -m pip --no-cache-dir install --extra-index-url https://testpypi.python.org/pypi FanFicFare==${FFF_RELEASE};     fi" did not complete successfully: exit code: 1

Thanks in advance.

might also happen if you try to install without -y in dockerfile:

RUN apt install -y whatever

But doesn’t look like this gradle action propagates errors properly to the workflow.

that’s by design with JReleaser, i don’t want the whole workflow to fail when docker fails to build/push

Here is the log of what command was invoked:

[DEBUG]     [docker] docker -l error buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --cache-from gotson/komga:latest --quiet --file /home/runner/work/komga/komga/komga/build/jreleaser/package/komga/docker/Dockerfile --tag docker.io/gotson/komga:latest --tag docker.io/gotson/komga:1.3.0 --tag docker.io/gotson/komga:1.x --tag ghcr.io/gotson/komga:latest --tag ghcr.io/gotson/komga:1.3.0 --tag ghcr.io/gotson/komga:1.x /home/runner/work/komga/komga/komga/build/jreleaser/package/komga/docker
[ERROR]     [docker] Dockerfile:8
[ERROR]     [docker] --------------------
[ERROR]     [docker]    7 |     # Install libjxl on x64 only. Homebrew is not available on other architectures.
[ERROR]     [docker]    8 | >>> RUN if [ "`uname -m`" = "x86_64" ]; then \
[ERROR]     [docker]    9 | >>>     apt -y update && \
[ERROR]     [docker]   10 | >>>     apt -y install git gcc && \
[ERROR]     [docker]   11 | >>>     NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
[ERROR]     [docker]   12 | >>>     eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
[ERROR]     [docker]   13 | >>>     brew install jpeg-xl; fi
[ERROR]     [docker]   14 |     
[ERROR]     [docker] --------------------
[ERROR]     [docker] 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

but the issue I had also happened on github actions with docker setup buildx

Probably also forgot to add https://github.com/docker/setup-qemu-action

I will give it a spin

Let us know thanks