nodejs/corepack

“Error: getaddrinfo EAI_AGAIN registry.npmmirror.com” on docker build

Closed this issue · 1 comments

Dockerfile:

FROM dockerproxy.net/library/node:22.9.0-slim AS base
..
ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
RUN corepack enable
..

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

Build error logs:

 => ERROR [prod-deps 1/1] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install                                                                                                                                                                  0.4s
------                                                                                                                                                                                                                                                         
 > [prod-deps 1/1] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install:                                                                                                                                                                             
0.321 /usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21609                                                                                                                                                                                         
0.321     throw new Error(                                                                                                                                                                                                                                     
0.321           ^                                                                                                                                                                                                                                              
0.321                                                                                                                                                                                                                                                          
0.321 Error: Error when performing the request to https://registry.npmmirror.com/pnpm/latest; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
0.321     at fetch (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21609:11)
0.321     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
0.321     at async fetchAsJson (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21623:20)
0.321     ... 4 lines matching cause stack trace ...
0.321     at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5) {
0.321   [cause]: TypeError: fetch failed
0.321       at node:internal/deps/undici/undici:13185:13
0.321       at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
0.321       at async fetch (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21603:16)
0.321       at async fetchAsJson (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21623:20)
0.321       at async fetchLatestStableVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21550:20)
0.321       at async fetchLatestStableVersion2 (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21672:14)
0.321       at async Engine.getDefaultVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22292:23)
0.321       at async Engine.executePackageManagerRequest (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22390:47)
0.321       at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5) {
0.321     [cause]: Error: getaddrinfo EAI_AGAIN registry.npmmirror.com
0.321         at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
0.321       errno: -3001,
0.321       code: 'EAI_AGAIN',
0.321       syscall: 'getaddrinfo',
0.321       hostname: 'registry.npmmirror.com'
0.321     }
0.321   }
0.321 }
0.321 
0.321 Node.js v22.9.0

I am getting this same issue