buildx: runc run failed: unable to start container process: /bin/sh no such file or directory

Run the PHP image followed by the commands in the RUN instruction below, and it should succeed. It only fails when using buildkit.

Dockerfile (partial)

FROM php:7.4-fpm-bullseye AS php

# (...)

RUN apt-get update && apt-get install -y \
    libicu-dev \
    libzip-dev \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
  && docker-php-ext-configure gd --with-freetype --with-jpeg \
  && docker-php-ext-install -j$(nproc) \
    gd \
    pdo_mysql \
    intl \
    zip \
    bcmath

Relevant build log fragment:

 => ERROR [php 6/8] RUN apt-get update && apt-get install -y     libicu-dev   0.3s
------
 > [php 6/8] RUN apt-get update && apt-get install -y     libicu-dev     libzip-dev     libfreetype6-dev     libjpeg62-turbo-dev     libpng-dev   && docker-php-ext-configure gd --with-freetype --with-jpeg   && docker-php-ext-install -j$(nproc)     gd     pdo_mysql     intl     zip     bcmath:
#0 0.298 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y     libicu-dev     libzip-dev     libfreetype6-dev     libjpeg62-turbo-dev     libpng-dev   && docker-php-ext-configure gd --with-freetype --with-jpeg   && docker-php-ext-install -j$(nproc)     gd     pdo_mysql     intl     zip     bcmath" did not complete successfully: exit code: 1
  • Docker version 23.0.0, build e92dd87
  • Xubuntu 22.10 kinetic on amd64

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 24
  • Comments: 31 (3 by maintainers)

Most upvoted comments

The command is docker system prune -a.

docker builder prune -a should be sufficient to unstick this, for anyone having problems.

Workaround:

sudo DOCKER_BUILDKIT=0 docker compose build

We got the same issue when receiving ubuntu 20.04 automatic upgrade from docker 20.10 to 23.0.0:

#14 0.436 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 ng lint --format=stylish" did not complete successfully: exit code: 1

it even generated an image with missing layers:

FROM xxx as builder
...

FROM alpine:3.15 as dist
COPY --from=builder /dist /dist

resulted in an image with just /dist, not the previous alpine layers. (actual case was more complex, but we did have missing layers vs before when exploring the tar w/ docker save).

We have rolled back to 20.10 docker-ce & docker-ce-cli for now.

Please make sure you’re using current buildx and current docker.

I did a system purge, i suppose that layers built from previous version of docker 23.0.0 were in an unexpected state