docker / docker/buildx

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

Open
#1,986 28 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status/triage
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

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_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported docker buildx build command with the supplied Dockerfile and compare it with the working docker build path. Examine the docker-container and docker builders in the builders list, focusing on the multi-platform targets and the /bin/sh: exec format error at Dockerfile line 8. Done means the differing behavior has a confirmed cause and an actionable fix or documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.