Docker build error
locke99gs opened this issue · comments
On a fresh and updated Ubuntu 22.04 container, using Docker version 24.0.6, build ed223bc installed same day from upstream docker repos per the installation instructions from Docker's site.
I can run hello-world just fine.
When building the docker container per the readme on the github page, I get an error from npm that it cannot install "zod":
root@openresume:/opt/open-resume# docker build -t open-resume .
[+] Building 553.3s (8/12) docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 71B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 360B 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.6s
=> [internal] load build context 0.0s
=> => transferring context: 10.43kB 0.0s
=> [builder 1/5] FROM docker.io/library/node:18-alpine@sha256:619ce27eb37c7c0476bd518085bf1ba892 0.0s
=> CACHED [builder 2/5] WORKDIR /app 0.0s
=> CACHED [builder 3/5] COPY . . 0.0s
=> ERROR [builder 4/5] RUN npm install --include=dev 552.6s
------
> [builder 4/5] RUN npm install --include=dev:
547.9 npm ERR! code ERR_SOCKET_TIMEOUT
547.9 npm ERR! errno ERR_SOCKET_TIMEOUT
547.9 npm ERR! network request to https://registry.npmjs.org/zod/-/zod-3.21.4.tgz failed, reason: Socket timeout
547.9 npm ERR! network This is a problem related to network connectivity.
547.9 npm ERR! network In most cases you are behind a proxy or have bad network settings.
547.9 npm ERR! network
547.9 npm ERR! network If you are behind a proxy, please make sure that the
547.9 npm ERR! network 'proxy' config is set properly. See: 'npm help config'
547.9
547.9 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-09-26T06_03_38_268Z-debug-0.log
------
Dockerfile:4
--------------------
2 | WORKDIR /app
3 | COPY . .
4 | >>> RUN npm install --include=dev
5 | RUN npm run build
6 |
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install --include=dev" did not complete successfully: exit code: 1
I am able to download this package directly from the same box:
root@openresume:/opt/open-resume# wget https://registry.npmjs.org/zod/-/zod-3.21.4.tgz
--2023-09-26 06:18:27-- https://registry.npmjs.org/zod/-/zod-3.21.4.tgz
Resolving registry.npmjs.org (registry.npmjs.org)... 104.16.2.35, 104.16.28.34, 104.16.0.35, ...
Connecting to registry.npmjs.org (registry.npmjs.org)|104.16.2.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 101416 (99K) [application/octet-stream]
Saving to: 'zod-3.21.4.tgz'
zod-3.21.4.tgz 100%[=====================================>] 99.04K --.-KB/s in 0.02s
2023-09-26 06:18:27 (4.23 MB/s) - 'zod-3.21.4.tgz' saved [101416/101416]
root@openresume:/opt/open-resume# ls -l zod-3.21.4.tgz
-rw-r--r-- 1 root root 101416 Mar 7 2023 zod-3.21.4.tgz
Nothing in the Dockerfile stands out to be as being suspicious or strange.
After waiting awhile and trying yet again , it got further then failed again:
[+] Building 93.6s (9/12) docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 71B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 360B 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.6s
=> [internal] load build context 0.0s
=> => transferring context: 10.43kB 0.0s
=> [builder 1/5] FROM docker.io/library/node:18-alpine@sha256:619ce27eb37c7c0476bd518085bf1ba892 0.0s
=> CACHED [builder 2/5] WORKDIR /app 0.0s
=> CACHED [builder 3/5] COPY . . 0.0s
=> [builder 4/5] RUN npm install --include=dev 32.9s
=> ERROR [builder 5/5] RUN npm run build 59.9s
------
> [builder 5/5] RUN npm run build:
1.175
1.175 > open-resume@0.1.0 build
1.175 > next build
1.175
1.890 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.892 This information is used to shape Next.js' roadmap and prioritize features.
1.892 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.893 https://nextjs.org/telemetry
1.893
2.036 - info Creating an optimized production build...
7.664 Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
7.664 Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
56.31 - info Compiled successfully
56.37 - info Linting and checking validity of types...
59.62 npm ERR! path /app
59.65 npm ERR! command failed
59.65 npm ERR! signal SIGKILL
59.65 npm ERR! command sh -c next build
59.68
59.69 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-09-26T06_29_10_431Z-debug-0.log
------
Dockerfile:5
--------------------
3 | COPY . .
4 | RUN npm install --include=dev
5 | >>> RUN npm run build
6 |
7 | FROM node:18-alpine AS runner
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
It seems like this may be a (hopefully temporary) issue on the npm registry side. I will try again after awhile or tomorrow.
edit: npm has a known degradation of service, so I'm probably just caught up in this at the moment.
The failures to npm run builid were simply that I did not have enough RAM in my container. Bumped the ram and it worked.
The initial issue was a degradation of service issue on NPM's side.