denoland/deno_docker

Latest image broke nodejs / npm usage (maybe related to libgcc)

Opened this issue · 5 comments

In our company we use the alpine deno image.
For some legacy stuff we need to add nodejs and npm on top of it, since the migration to deno is not fully completed yet.

Since the latest version 1.41.0 this won't work anymore.

It looks like installation is done successfully but as soon as you try to execute node -v we get the error message

Image: denoland/deno:alpine (1.41.0) [not working]

/ # apk add nodejs npm
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
(1/12) Installing ca-certificates (20230506-r0)
(2/12) Installing libgcc (13.2.1_git20231014-r0)
(3/12) Installing libstdc++ (13.2.1_git20231014-r0)
(4/12) Installing ada-libs (2.7.4-r0)
(5/12) Installing libbase64 (0.5.0-r0)
(6/12) Installing brotli-libs (1.1.0-r1)
(7/12) Installing c-ares (1.24.0-r1)
(8/12) Installing icu-data-en (74.1-r0)
Executing icu-data-en-74.1-r0.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(9/12) Installing icu-libs (74.1-r0)
(10/12) Installing nghttp2-libs (1.58.0-r0)
(11/12) Installing nodejs (20.11.1-r0)
(12/12) Installing npm (10.2.5-r0)
Executing busybox-1.36.1-r15.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 74 MiB in 27 packages
/ # node -v
Error relocating /usr/local/lib/libgcc_s.so.1: __cpu_indicator_init: symbol not found
Error relocating /usr/local/lib/libgcc_s.so.1: __cpu_model: symbol not found

In the version 14.0.5 it's working
Image: denoland/deno:alpine-14.0.5 [working]

/ # apk add nodejs npm
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
(1/9) Installing ca-certificates (20230506-r0)
(2/9) Installing brotli-libs (1.0.9-r14)
(3/9) Installing c-ares (1.19.1-r0)
(4/9) Installing icu-data-en (73.2-r2)
Executing icu-data-en-73.2-r2.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(5/9) Installing libstdc++ (12.2.1_git20220924-r10)
(6/9) Installing icu-libs (73.2-r2)
(7/9) Installing nghttp2-libs (1.57.0-r0)
(8/9) Installing nodejs (18.19.1-r0)
(9/9) Installing npm (9.6.6-r0)
Executing busybox-1.36.1-r5.trigger
Executing glibc-bin-2.34-r0.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 74 MiB in 27 packages
/ # node -v
v20.11.1

I also tried latest plain alpine image (3.19.1)
where it's also working as expected

Image: alpine:latest (3.19.1) [working]

/ # apk add nodejs npm
(1/12) Installing ca-certificates (20230506-r0)
(2/12) Installing libgcc (13.2.1_git20231014-r0)
(3/12) Installing libstdc++ (13.2.1_git20231014-r0)
(4/12) Installing ada-libs (2.7.4-r0)
(5/12) Installing libbase64 (0.5.0-r0)
(6/12) Installing brotli-libs (1.1.0-r1)
(7/12) Installing c-ares (1.24.0-r1)
(8/12) Installing icu-data-en (74.1-r0)
Executing icu-data-en-74.1-r0.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(9/12) Installing icu-libs (74.1-r0)
(10/12) Installing nghttp2-libs (1.58.0-r0)
(11/12) Installing nodejs (20.11.1-r0)
(12/12) Installing npm (10.2.5-r0)
Executing busybox-1.36.1-r15.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 74 MiB in 27 packages
/ # node -v
v20.11.1

@mmastrac can you take a look?

@schettgen

Does installing the official node package work for you?

This one might be difficult for us to fix for a bit as it might require some research -- we copy enough of glibc from distroless that we can make the deno binary work.

wget https://nodejs.org/dist/v20.9.0/node-v20.9.0-linux-x64.tar.xz -O /tmp/node.tar.xz
cd /tmp/ && tar --exclude 'node-*/include/*' -xvf node.tar.xz > /dev/null && cd -
export PATH=/tmp/node-v20.9.0-linux-x64/bin:$PATH

I created new docker with docker run --name deno_wget -d denoland/deno:alpine tail -f /dev/null

and executed command above

It's also not working see output below

/ # wget https://nodejs.org/dist/v20.9.0/node-v20.9.0-linux-x64.tar.xz -O /tmp/node.tar.xz
Connecting to nodejs.org (104.20.22.46:443)
saving to '/tmp/node.tar.xz'
node.tar.xz          100% |*****************************************************************************************| 24.0M  0:00:00 ETA
'/tmp/node.tar.xz' saved
/ # cd /tmp/ && tar --exclude 'node-*/include/*' -xvf node.tar.xz > /dev/null && cd -

/
/ # export PATH=/tmp/node-v20.9.0-linux-x64/bin:$PATH
/ # 
/ # node -v
node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/ #

Similar problem here with ffmpeg installed on top of denoland/deno:alpine-1.41.0 and above:

$ apk update && apk add ffmpeg
$ ffmpeg -version
Error relocating /usr/local/lib/libgcc_s.so.1: __cpu_indicator_init: symbol not found
Error relocating /usr/local/lib/libgcc_s.so.1: __cpu_model: symbol not found
Error relocating /usr/lib/libhwy.so.1: __extendhfdf2: symbol not found

It's working as expected with 1.40.5 and below.

There's some "magic" in the Alpine Dockerfile that copies files from the cc image. Maybe the versions from cc don't match the versions expected by Alpine packages?

Any updates here?