Skip to content

Instantly share code, notes, and snippets.

@neersighted
Last active February 8, 2023 00:25
Show Gist options
  • Save neersighted/8bccac67a66ad2163c3e6ff02d412f29 to your computer and use it in GitHub Desktop.
Save neersighted/8bccac67a66ad2163c3e6ff02d412f29 to your computer and use it in GitHub Desktop.

On host system:

$ multipass launch -n repro 22.04 && multipass shell repro

Inside VM:

$ sudo -i

# curl https://get.docker.com | VERSION=20.10.23 sh

# docker version
Client: Docker Engine - Community
 Version:           20.10.23
 API version:       1.41
 Go version:        go1.18.10
 Git commit:        7155243
 Built:             Thu Jan 19 17:33:18 2023
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.23
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.10
  Git commit:       6051f14
  Built:            Thu Jan 19 17:31:30 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.16
  GitCommit:        31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Pre-upgrade steps:

# mkdir -p /tmp/repro && cd /tmp/repro

# echo "exit 1" > /tmp/repro/entrypoint.sh

# cat >/tmp/repro/Dockerfile <<EOF
FROM php:8.1.12-fpm-alpine3.16
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
EOF

# DOCKER_BUILDKIT=1 docker build -t test .
[+] Building 3.7s (9/9) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                        0.0s
 => => transferring dockerfile: 160B                                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/php:8.1.12-fpm-alpine3.16                                                                                                                                                                                                1.6s
 => [internal] load build context                                                                                                                                                                                                                                           0.0s
 => => transferring context: 47B                                                                                                                                                                                                                                            0.0s
 => [1/3] FROM docker.io/library/php:8.1.12-fpm-alpine3.16@sha256:fb54571d659a7e474377a2821a7a874667da4db48e9b9062ff088a8ebd7f3cea                                                                                                                                          1.8s
 => => resolve docker.io/library/php:8.1.12-fpm-alpine3.16@sha256:fb54571d659a7e474377a2821a7a874667da4db48e9b9062ff088a8ebd7f3cea                                                                                                                                          0.0s
 => => sha256:fd698c26bd17e47cae3e287202cee1112230b8c1e3b6eff40ab1c13d26737998 1.26kB / 1.26kB                                                                                                                                                                              0.6s
 => => sha256:6875df1f535433e5affe18ecfde9acb7950ab5f76887980ff06c5cdd48cf98f4 2.71MB / 2.71MB                                                                                                                                                                              0.6s
 => => sha256:efd6b5dfa09afb0dfbd7d109e2fa7a0301a03e00783d8b4bb5747cf2ae156f29 2.41kB / 2.41kB                                                                                                                                                                              0.0s
 => => sha256:4ce39a95ca358cbd7ff644af665f5b6589016f407e249ad8b69ab3a1c8fc6479 10.76kB / 10.76kB                                                                                                                                                                            0.0s
 => => sha256:76d018a6b8f2b9d3c88bb51b66bb27c7840ca587dc27d7b18ed9d29271f7a801 1.72MB / 1.72MB                                                                                                                                                                              0.6s
 => => sha256:fb54571d659a7e474377a2821a7a874667da4db48e9b9062ff088a8ebd7f3cea 1.65kB / 1.65kB                                                                                                                                                                              0.0s
 => => extracting sha256:6875df1f535433e5affe18ecfde9acb7950ab5f76887980ff06c5cdd48cf98f4                                                                                                                                                                                   0.1s
 => => sha256:9d804918576056f288bba1c63c140494fb4cfd8c845d79c029e38fba1f5665ee 268B / 268B                                                                                                                                                                                  0.7s
 => => sha256:8343d80c598831eb6828e5b4194ad7c2f04b9b76dcd466bc31845a0745cd1d73 11.77MB / 11.77MB                                                                                                                                                                            1.0s
 => => sha256:baadabd7ee66c3daf8c8fd7954281e461de4d938b536bef9f802bcdfdd13f3b5 493B / 493B                                                                                                                                                                                  0.7s
 => => extracting sha256:76d018a6b8f2b9d3c88bb51b66bb27c7840ca587dc27d7b18ed9d29271f7a801                                                                                                                                                                                   0.2s
 => => sha256:be8b1298dd678e8adeb0379f2f232229461c47f8daf9407c956ae494fdc2cb96 12.43MB / 12.43MB                                                                                                                                                                            1.0s
 => => sha256:b449e91641719f84488339bc3b25a138172528e0cb4f3170331a5f354060405b 2.45kB / 2.45kB                                                                                                                                                                              0.9s
 => => sha256:68ff34a4670e386f5447045e64394073839cc99a9b7f2fc38619caefe9d12c1d 18.67kB / 18.67kB                                                                                                                                                                            1.0s
 => => extracting sha256:fd698c26bd17e47cae3e287202cee1112230b8c1e3b6eff40ab1c13d26737998                                                                                                                                                                                   0.0s
 => => extracting sha256:9d804918576056f288bba1c63c140494fb4cfd8c845d79c029e38fba1f5665ee                                                                                                                                                                                   0.0s
 => => extracting sha256:8343d80c598831eb6828e5b4194ad7c2f04b9b76dcd466bc31845a0745cd1d73                                                                                                                                                                                   0.1s
 => => sha256:52cda1d365744c8f10dd0dc40b079907589433245fbd2bf175352350eae8aae1 8.62kB / 8.62kB                                                                                                                                                                              1.1s
 => => extracting sha256:baadabd7ee66c3daf8c8fd7954281e461de4d938b536bef9f802bcdfdd13f3b5                                                                                                                                                                                   0.0s
 => => extracting sha256:be8b1298dd678e8adeb0379f2f232229461c47f8daf9407c956ae494fdc2cb96                                                                                                                                                                                   0.4s
 => => extracting sha256:b449e91641719f84488339bc3b25a138172528e0cb4f3170331a5f354060405b                                                                                                                                                                                   0.0s
 => => extracting sha256:68ff34a4670e386f5447045e64394073839cc99a9b7f2fc38619caefe9d12c1d                                                                                                                                                                                   0.0s
 => => extracting sha256:52cda1d365744c8f10dd0dc40b079907589433245fbd2bf175352350eae8aae1                                                                                                                                                                                   0.0s
 => [2/3] COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh                                                                                                                                                                                                                 0.0s
 => [3/3] RUN chmod +x /usr/local/bin/entrypoint.sh                                                                                                                                                                                                                         0.2s
 => exporting to image                                                                                                                                                                                                                                                      0.0s
 => => exporting layers                                                                                                                                                                                                                                                     0.0s
 => => writing image sha256:652802d28bcfe3d68d5ce4e9d49b5a1b673a60bc628875ddc2fc83e7404aed7d                                                                                                                                                                                0.0s
 => => naming to docker.io/library/test                                                                                                                                                                                                                                     0.0s
 => exporting cache                                                                                                                                                                                                                                                         0.0s
 => => preparing build cache for export                                                                                                                                                                                                                                     0.0s                                                                                         

Post-upgrade steps:

# apt install docker-ce=5:23.0.0-1~ubuntu.22.04~jammy docker-ce-cli=5:23.0.0-1~ubuntu.22.04~jammy

# docker version
Client: Docker Engine - Community
 Version:           23.0.0
 API version:       1.42
 Go version:        go1.19.5
 Git commit:        e92dd87
 Built:             Wed Feb  1 17:46:28 2023
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.0
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.5
  Git commit:       d7573ab
  Built:            Wed Feb  1 17:46:28 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.16
  GitCommit:        31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

# cat >/tmp/repro/Dockerfile <<EOF
FROM php:8.1.12-fpm-alpine3.16
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
RUN uname -a
EOF

# DOCKER_BUILDKIT=1 docker build -t test .
[+] Building 1.6s (8/8) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                        0.0s
 => => transferring dockerfile: 175B                                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/php:8.1.12-fpm-alpine3.16                                                                                                                                                                                                1.4s
 => [internal] load build context                                                                                                                                                                                                                                           0.0s
 => => transferring context: 47B                                                                                                                                                                                                                                            0.0s
 => [1/4] FROM docker.io/library/php:8.1.12-fpm-alpine3.16@sha256:fb54571d659a7e474377a2821a7a874667da4db48e9b9062ff088a8ebd7f3cea                                                                                                                                          0.0s
 => CACHED [2/4] COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh                                                                                                                                                                                                          0.0s
 => CACHED [3/4] RUN chmod +x /usr/local/bin/entrypoint.sh                                                                                                                                                                                                                  0.0s
 => ERROR [4/4] RUN uname -a                                                                                                                                                                                                                                                0.1s
------
 > [4/4] RUN uname -a:
#0 0.140 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile:4
--------------------
   2 |     COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
   3 |     RUN chmod +x /usr/local/bin/entrypoint.sh
   4 | >>> RUN uname -a
   5 |
--------------------
ERROR: failed to solve: process "/bin/sh -c uname -a" did not complete successfully: exit code: 1

On host system:

$ multipass launch -n repro 22.04 && multipass shell repro

Inside VM:

$ sudo -i

# curl https://get.docker.com | VERSION=20.10.23 sh

# docker version
Client: Docker Engine - Community
 Version:           20.10.23
 API version:       1.41
 Go version:        go1.18.10
 Git commit:        7155243
 Built:             Thu Jan 19 17:33:18 2023
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.23
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.10
  Git commit:       6051f14
  Built:            Thu Jan 19 17:31:30 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.16
  GitCommit:        31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Pre-upgrade steps:

# mkdir -p /tmp/repro && cd /tmp/repro

# DOCKER_BUILDKIT=1 docker build -t test -f- . <<EOF
FROM node:18-alpine as base
WORKDIR /app

FROM base
RUN ls
EOF

Post-upgrade steps:

# apt install docker-ce=5:23.0.0-1~ubuntu.22.04~jammy docker-ce-cli=5:23.0.0-1~ubuntu.22.04~jammy

# docker version
Client: Docker Engine - Community
 Version:           23.0.0
 API version:       1.42
 Go version:        go1.19.5
 Git commit:        e92dd87
 Built:             Wed Feb  1 17:46:28 2023
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.0
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.5
  Git commit:       d7573ab
  Built:            Wed Feb  1 17:46:28 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.16
  GitCommit:        31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

# DOCKER_BUILDKIT=1 docker build -t test -f- . <<EOF
FROM node:18-alpine as base
WORKDIR /app

FROM base
RUN uname -a
EOF
[+] Building 0.4s (6/6) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                        0.0s
 => => transferring dockerfile: 102B                                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine                                                                                                                                                                                                           0.3s
 => [base 1/2] FROM docker.io/library/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3                                                                                                                                                0.0s
 => CACHED [base 2/2] WORKDIR /app                                                                                                                                                                                                                                          0.0s
 => ERROR [stage-1 1/1] RUN uname -a                                                                                                                                                                                                                                        0.1s
------
 > [stage-1 1/1] RUN uname -a:
#0 0.138 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile:5
--------------------
   3 |
   4 |     FROM base
   5 | >>> RUN uname -a
   6 |
--------------------
ERROR: failed to solve: process "/bin/sh -c uname -a" did not complete successfully: exit code: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment