Issue building docker image

Hi,
I am trying to build a docker image with changes I made to test the end result, but the build process fails.

$ docker build . 
[+] Building 1.9s (14/21)                                                                                      docker:default
 => [internal] load build definition from Dockerfile                                                                     0.0s
 => => transferring dockerfile: 1.73kB                                                                                   0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1                                                0.4s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d8  0.0s
 => [internal] load build definition from Dockerfile                                                                     0.0s
 => [internal] load metadata for ghcr.io/techknowlogick/xgo:go-1.23.x                                                    0.4s
 => [internal] load metadata for docker.io/library/node:22.13.1-alpine                                                   0.4s
 => [internal] load .dockerignore                                                                                        0.0s
 => => transferring context: 210B                                                                                        0.0s
 => [frontendbuilder 1/4] FROM docker.io/library/node:22.13.1-alpine@sha256:e2b39f7b64281324929257d0f8004fb6cb4bf0fdfb9  0.0s
 => CANCELED [apibuilder 1/6] FROM ghcr.io/techknowlogick/xgo:go-1.23.x@sha256:e26481c0fe292596586071855abf1cba42324c13  0.6s
 => => resolve ghcr.io/techknowlogick/xgo:go-1.23.x@sha256:e26481c0fe292596586071855abf1cba42324c1344a3cc359e900d37d331  0.1s
 => => sha256:bd111cbd72e85f6858a8ca95382ab8c5163589e263ade7c668b42bc9ce77e044 14.50kB / 14.50kB                         0.0s
 => => sha256:de44b265507ae44b212defcb50694d666f136b35c1090d9709068bc861bb2d64 14.68MB / 29.75MB                         0.8s
 => => sha256:9ad44861c2fcb553518892773a4bcfcc84bdce1ccea310e282505bcc7800d85a 470B / 470B                               0.2s
 => => sha256:e26481c0fe292596586071855abf1cba42324c1344a3cc359e900d37d3317348 1.61kB / 1.61kB                           0.0s
 => => sha256:5c0dd2ea1f7435f406ef725c8ba62d22464121e019e5d575b0bc156d0f479453 472B / 472B                               0.3s
 => => sha256:fce26b5b37f0861d0a7c6e2e379959a0001aed156af2dbe31c3a741a18408d45 5.05kB / 5.05kB                           0.0s
 => => sha256:98f4d5d76048ad4a2c1fc46fdf0a12ee2993c9a670d6c32b821a01b3299fb657 1.05MB / 2.24GB                           0.8s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                 0.5s
 => CACHED [stage-2 1/3] WORKDIR /app/vikunja                                                                            0.0s
 => [internal] load build context                                                                                        0.1s
 => => transferring context: 76.92kB                                                                                     0.0s
 => CACHED [frontendbuilder 2/4] WORKDIR /build                                                                          0.0s
 => CACHED [frontendbuilder 3/4] COPY frontend/ ./                                                                       0.0s
 => ERROR [frontendbuilder 4/4] RUN corepack enable &&       pnpm install &&       pnpm run build                        0.5s
------
 > [frontendbuilder 4/4] RUN corepack enable &&       pnpm install &&       pnpm run build:
0.406 /usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21535
0.406   if (key == null || signature == null) throw new Error(`Cannot find matching keyid: ${JSON.stringify({ signatures, keys })}`);
0.406                                               ^
0.406 
0.406 Error: Cannot find matching keyid: {"signatures":[{"sig":"MEQCIBfxS9RKPsi46jxBHnsGYQ03mg8um110415vE6KRCzY8AiBvik66sYxJ/NyCovwJSbDuuoaYCxc7EVdFhaaciIXjTw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"keys":[{"expires":null,"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg=="}]}
0.406     at verifySignature (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21535:47)
0.406     at fetchLatestStableVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21553:5)
0.406     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
0.406     at async fetchLatestStableVersion2 (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21672:14)
0.406     at async Engine.getDefaultVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22298:23)
0.406     at async Engine.executePackageManagerRequest (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22396:47)
0.406     at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23102:5)
0.406 
0.406 Node.js v22.13.1
------
Dockerfile:12
--------------------
  11 |     
  12 | >>> RUN corepack enable && \
  13 | >>>       pnpm install && \
  14 | >>>       pnpm run build
  15 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c corepack enable &&       pnpm install &&       pnpm run build" did not complete successfully: exit code: 1

Any idea what I am missing ? I am not very experienced building docker images, so it might just be a silly thing I am missing.

1 Like

I was able to build successfully just couple of commits ago.
Now I experience the same issue as author of topic.

UPD: no actually I can’t even build older versions that I was able to build…
Weird… Something with Docker repos themselves?
Cache needs to be cleared?

Testing out promising Dockerfile fix…

@kolaente
Docker buildbreak is reproducible on latest commit of main branch.
The issue seems to be related to Corepack signature key rotation (whatever it means).

The following fix was proved to fix the buildbreak:

# Replace lines 13-15 in Dockerfile with following code.
# Ensures Corepack is up-to-date before enabling it.
# Avoids issues with outdated or missing Corepack keys.
# Without installing Corepack explicitly:
# - Relies on the Corepack version preinstalled in the Node.js image
# - If it's outdated or broken (which is happening in Node.js 22), signature verification fails.
RUN npm i -g corepack && \
    corepack enable && \
    pnpm install && \
    pnpm run build

I’m not Corepack/NodeJS expert, but it makes sense to me.

Workaround
@jyte you can apply the suggested fix as a workaround.
If fix by itself doesn’t work - leave the fix as it is and try building without Docker cache with following command:

docker build --no-cache .

Thank you it worked great !

Now my next issue is to find how to deploy that image in place of the one in used on my server via compose file…

This is an upstream issue in corepack: Cannot install pnpm with corepack: `corepack use pnpm@latest-x` · Issue #9029 · pnpm/pnpm · GitHub

I’ve pushed a fix in 2bba1e86cf .

You can either push it to docker hub under a custom tag and then use that, or build it locally on your server.

1 Like