docker-node icon indicating copy to clipboard operation
docker-node copied to clipboard

docker buildx hang on node:22-alpine (armv6/armv7)

Open pheiduck opened this issue 1 year ago • 17 comments

Environment

  • Platform: GitHub CI
  • Docker Version: 24.0.9
  • Node.js Version: 22
  • Image Tag: node:22-alpine

Expected Behavior

No hanging build on armv6/armv7

Current Behavior

build is hanging on npm ci --omit=dev

Possible Solution

none

Steps to Reproduce

run docker deployment on github ci

Additional Information

Logs: https://productionresultssa4.blob.core.windows.net/actions-results/c81c7c78-0f17-4d1b-bb6e-eedc5023c285/workflow-job-run-e07742bd-189a-5079-918b-43f8b2f94b89/logs/job/job-logs.txt?rsct=text%2Fplain&se=2024-05-04T18%3A34%3A48Z&sig=kywF%2F31fsM6a0PFRA%2BGMwEYu9RkOcGzkAq1EUZumrx8%3D&sp=r&spr=https&sr=b&st=2024-05-04T18%3A24%3A43Z&sv=2021-12-02

pheiduck avatar May 04 '24 18:05 pheiduck

This is a known issue with the armv6 armv7. No solution has been found yet

LaurentGoderre avatar May 06 '24 13:05 LaurentGoderre

I believe the Alpine builds, except ppcle are working again

nschonni avatar May 11 '24 18:05 nschonni

Glade to hear will try it.

pheiduck avatar May 11 '24 18:05 pheiduck

I believe the Alpine builds, except ppcle are working again

armv6/7 still not working

pheiduck avatar May 11 '24 19:05 pheiduck

Yeah, I don't think the root cause of this has been found yet.

LaurentGoderre avatar May 13 '24 13:05 LaurentGoderre

I had the same issue with node:20.14.0-alpine for arm/v7 (cannot say anything about arm/v6). Adding --platform=$BUILDPLATFORM to FROM solved it for me. Read about it in the docs. This is what my multistage Dockerfile now looks like:

ARG BASE_IMAGE=node:20.14.0-alpine

FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder
RUN /build/stuff
...

FROM --platform=$BUILDPLATFORM ${BASE_IMAGE}
COPY --from=builder /stuff ./
...

pabra avatar Jun 13 '24 16:06 pabra

@pabra I might be simpler to specify the platform in the command instead of in the Dockerfile like docker build --platform linux/arm/v7 and docker run --platform linux/arm/v7

LaurentGoderre avatar Jun 13 '24 17:06 LaurentGoderre

@pabra on github CI this will use the host arch, which does not solve my issue here. build npm pkgs on an older nodejs is the way to go until now...

pheiduck avatar Jun 13 '24 18:06 pheiduck

@LaurentGoderre @pheiduck I use this Dockerfile with this github action. And it now builds images for platforms: linux/amd64,linux/arm64,linux/arm/v7. Without --platform=$BUILDPLATFORM in the Dockerfile, it hang for arm v7.

Not sure what you are doing, @pheiduck. I use docker buildx with qemu in CI, so $BUILDPLATFORM is not the host arch but the arch emulated by qemu. Maybe $TARGETPLATFORM is for you?

pabra avatar Jun 14 '24 21:06 pabra

Maybe $TARGETPLATFORM is for you?

Will try it

pheiduck avatar Jun 14 '24 23:06 pheiduck

$TARGETPLATFORM does not work either...

pheiduck avatar Jun 15 '24 10:06 pheiduck

I cannot believe this has gone on so long without a resolution since 18.x builds. Appears so many issues raised across multiple issues

n0rt0nthec4t avatar Jun 17 '24 01:06 n0rt0nthec4t

It seems the error is that it runs out of memory:

docker run --cap-add=SYS_PTRACE -e QEMU_STRACE=1 --rm -it --platform linux/arm/v7 node:22-alpine
1 mremap(1082126336,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082122240,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082118144,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082114048,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082109952,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082105856,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082101760,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)
1 mremap(1082097664,4096,8192,0,0,1082133536) = -1 errno=12 (Out of memory)

LaurentGoderre avatar Jun 17 '24 14:06 LaurentGoderre

https://github.com/nodejs/node/issues/53489

LaurentGoderre avatar Jun 17 '24 14:06 LaurentGoderre

Unfortunately for us going back to older node isnt an option as the platform we use is now dependent on the newer node version, but of course this issue prevents us from being able to deploy—stuck between a rock and a hard place!

Wish I had a way to help try and solve, thanks for everyone's time.

shamoon avatar Jul 08 '24 05:07 shamoon

Unfortunately for us going back to older node isnt an option as the platform we use is now dependent on the newer node version, but of course this issue prevents us from being able to deploy—stuck between a rock and a hard place!

Wish I had a way to help try and solve, thanks for everyone's time.

A Workaround we found out is to copy ofter build result to the newer image

pheiduck avatar Jul 08 '24 09:07 pheiduck

Thanks so much for the suggestion, unfortunately I dont think that works for us as we cant run the build on an older version with the updated package we want to use (next.js v14).

Fingers crossed this one gets solved 🤞

shamoon avatar Jul 08 '24 14:07 shamoon