Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: alpine image #50

Open
vanodevium opened this issue Aug 31, 2023 · 9 comments
Open

Docker: alpine image #50

vanodevium opened this issue Aug 31, 2023 · 9 comments

Comments

@vanodevium
Copy link

I ran into a problem and I can't find a way out.
Please let me know if it is at all possible to install chrome inside the alpine image via npx.

If the answer is yes, please show an example of how to do it.
Thank you!


Dockerfile:

FROM node:18-alpine3.18

ENV CHROME_BIN=/chrome/linux-116.0.5845.96/chrome-linux64/chrome

RUN npx --yes @puppeteer/[email protected] install [email protected]

It unzips fine, but won't run from terminal or puppeteer.

From puppeteer I see:

Error: Failed to launch the browser process! spawn /chrome/linux-116.0.5845.96/chrome-linux64 EACCES

puppeteer version: 21.1.1

@thiagowfx
Copy link
Contributor

thiagowfx commented Sep 18, 2023

There are no more logs?

I suspect the issue is missing dependencies: x-ref #55

While not ideal, try this:

doas apk add chromium

...to install the usual dependencies for chromium (which should be mostly the same as of the ones for CfT). Then try again.

@vanodevium
Copy link
Author

Hello!
Experimentally, I came to the conclusion that only by installing all these dependencies, Chrome will be able to work in Alpine.

It would be good if there was documentation that would describe what exactly needs to be installed for different docker images, so that we can then download different versions of Chrome and use it for the necessary tasks.

libfontenc
mkfontscale
font-opensans
hicolor-icon-theme
gtk-update-icon-cache
libxcomposite
libxfixes
libxcursor
libxdamage
libxi
libxinerama
libxrandr
libatk-1.0
libxtst
dbus-libs
at-spi2-core
libatk-bridge-2.0
avahi-libs
nettle
p11-kit
libtasn1
gnutls
cups-libs
libepoxy
wayland-libs-client
wayland-libs-cursor
wayland-libs-egl
xkeyboard-config
libxkbcommon
gtk+3.0
icu-data-full
mesa
llvm15-libs
hwdata-pci
libpciaccess
libdrm
musl-fts
libelf
mesa-glapi
mesa-dri-gallium
eudev-libs
libice
libsm
libxt
libxmu
xset
xprop
xdg-utils
libogg
flac-libs
alsa-lib
svt-av1-libs
aom-libs
libva
libvdpau
onevpl-libs
ffmpeg-libavutil
libdav1d
libhwy
libjxl
lame-libs
opus
soxr
ffmpeg-libswresample
libtheora
libvorbis
libvpx
x264-libs
numactl
x265-libs
xvidcore
ffmpeg-libavcodec
libbluray
mpg123-libs
libopenmpt
cjson
mbedtls
librist
libsrt
libssh
libsodium
libzmq
ffmpeg-libavformat
libevent
wayland-libs-server
mesa-gbm
jsoncpp
minizip
nspr
nss
pipewire-libs
libasyncns
libltdl
libsndfile
speexdsp
tdb-libs
libpulse
re2
snappy
libwoff2common
libwoff2enc
vips-jxl

@vanodevium
Copy link
Author

@thiagowfx

Oh sorry,

yes, there are no more logs.

@gmile
Copy link

gmile commented Sep 19, 2023

@vanodevium can you past your full command history, installing dependencies and running Chrome? I tried a different path by installing missing dynamic dependencies reported by ldd, but wasn't able to get chrome-for-testing to work. Here my approach:

  1. first, enter Alpine container:

    docker run -it alpine:3.18 ash
  2. then:

    apk add npm
    npx --yes @puppeteer/[email protected] install chrome-headless-shell@118
    apk add \
      glib nss libatk-1.0 libexpat libx11 gcompat dbus-libs \
      at-spi2-core alsa-lib libxkbcommon libdrm mesa-gbm libxrandr \
      libxfixes libxcomposite libxdamage libc6-compat
  3. running chrome-for-testing fails:

    $ /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell
    [0919/085750.576137:ERROR:icu_util.cc(240)] Invalid file descriptor to ICU data received.
    Trace/breakpoint trap (core dumped)
    # 
    

I used ldd utility to check how chrome-for-testing is being linked, and I get a lot of errors - most of them were removed by installing missing packages, but a handful remains:

# ldd /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell
...bunch of correct dynamic links are skipped for brevity.
        libXau.so.6 => /usr/lib/libXau.so.6 (0x7efe5e34d000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x7efe5e345000)
        libblkid.so.1 => /lib/libblkid.so.1 (0x7efe5e2fc000)
        libbsd.so.0 => /usr/lib/libbsd.so.0 (0x7efe5e2e9000)
        libmd.so.0 => /usr/lib/libmd.so.0 (0x7efe5e2dd000)
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __memcpy_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __memset_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __vsnprintf_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __vfprintf_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __res_ninit: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __res_nclose: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __mbrlen: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: strtoll_l: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: strtoull_l: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __sched_cpualloc: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __sched_cpufree: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __longjmp_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __fprintf_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __snprintf_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: initstate_r: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: random_r: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __fdelt_chk: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __register_atfork: symbol not found
Error relocating /chrome-headless-shell/linux-118.0.5993.3/chrome-headless-shell-linux64/chrome-headless-shell: __libc_stack_end: symbol not found

There's some evidence the problem may be coming from libc6-compat packages.

I am not sure merely installing chromium would help either, since chromium package for Alpine has many custom patches to make it work on Alpine, see this. But to be honest, I haven't tried this approach.

Will need to look into this more. For now I am blocked with installing chrome-for-testing on Alpine.

@OrKoN
Copy link
Collaborator

OrKoN commented Sep 19, 2023

The following should be the list of packages that are needed on Debian Linux https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/linux/debian/dist_package_versions.json

@vanodevium
Copy link
Author

@gmile

requirements.txt

libfontenc
mkfontscale
font-opensans
hicolor-icon-theme
gtk-update-icon-cache
libxcomposite
libxfixes
libxcursor
libxdamage
libxi
libxinerama
libxrandr
libatk-1.0
libxtst
dbus-libs
at-spi2-core
libatk-bridge-2.0
avahi-libs
nettle
p11-kit
libtasn1
gnutls
cups-libs
libepoxy
wayland-libs-client
wayland-libs-cursor
wayland-libs-egl
xkeyboard-config
libxkbcommon
gtk+3.0
icu-data-full
mesa
llvm15-libs
hwdata-pci
libpciaccess
libdrm
musl-fts
libelf
mesa-glapi
mesa-dri-gallium
eudev-libs
libice
libsm
libxt
libxmu
xset
xprop
xdg-utils
libogg
flac-libs
alsa-lib
svt-av1-libs
aom-libs
libva
libvdpau
onevpl-libs
ffmpeg-libavutil
libdav1d
libhwy
libjxl
lame-libs
opus
soxr
ffmpeg-libswresample
libtheora
libvorbis
libvpx
x264-libs
numactl
x265-libs
xvidcore
ffmpeg-libavcodec
libbluray
mpg123-libs
libopenmpt
cjson
mbedtls
librist
libsrt
libssh
libsodium
libzmq
ffmpeg-libavformat
libevent
wayland-libs-server
mesa-gbm
jsoncpp
minizip
nspr
nss
pipewire-libs
libasyncns
libltdl
libsndfile
speexdsp
tdb-libs
libpulse
re2
snappy
libwoff2common
libwoff2enc
vips-jxl
gcompat
libc6-compat

Dockerfile

FROM node:18-alpine3.18

COPY ./requirements.txt ./

RUN cat requirements.txt | xargs apk add

RUN npx --yes @puppeteer/[email protected] install [email protected]

After build, exec bash
And then:

ldd /chrome/linux-116.0.5845.96/chrome-linux64/chrome
        /lib64/ld-linux-x86-64.so.2 (0x7f8b0f0ef000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f8b0f0ef000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f8b0f0ef000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x7f8b01872000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x7f8b01728000)
        libnss3.so => /usr/lib/libnss3.so (0x7f8b015f4000)
        libnssutil3.so => /usr/lib/libnssutil3.so (0x7f8b015c7000)
        libsmime3.so => /usr/lib/libsmime3.so (0x7f8b0159d000)
        libnspr4.so => /usr/lib/libnspr4.so (0x7f8b0155d000)
        libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x7f8b0153b000)
        libatk-bridge-2.0.so.0 => /usr/lib/libatk-bridge-2.0.so.0 (0x7f8b01504000)
        libcups.so.2 => /usr/lib/libcups.so.2 (0x7f8b0147a000)
        libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0x7f8b012b5000)
        libdrm.so.2 => /usr/lib/libdrm.so.2 (0x7f8b0129f000)
        libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x7f8b01259000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x7f8b01238000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x7f8b01211000)
        libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0 (0x7f8b011d3000)
        libatspi.so.0 => /usr/lib/libatspi.so.0 (0x7f8b0119f000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x7f8b01081000)
        libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0x7f8b0107c000)
        libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x7f8b01077000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x7f8b01066000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x7f8b0105e000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x7f8b01052000)
        libgbm.so.1 => /usr/lib/libgbm.so.1 (0x7f8b01042000)
        libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x7f8b00fed000)
        libcairo.so.2 => /usr/lib/libcairo.so.2 (0x7f8b00f06000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0x7f8b00e25000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f8b0f0ef000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f8b00e07000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f8b0f0ef000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f8b00e01000)
        libffi.so.8 => /usr/lib/libffi.so.8 (0x7f8b00df7000)
        libintl.so.8 => /usr/lib/libintl.so.8 (0x7f8b00dea000)
        libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x7f8b00d48000)
        libplds4.so => /usr/lib/libplds4.so (0x7f8b00d43000)
        libplc4.so => /usr/lib/libplc4.so (0x7f8b00d3c000)
        libavahi-common.so.3 => /usr/lib/libavahi-common.so.3 (0x7f8b00d2f000)
        libavahi-client.so.3 => /usr/lib/libavahi-client.so.3 (0x7f8b00d1e000)
        libgnutls.so.30 => /usr/lib/libgnutls.so.30 (0x7f8b00b4f000)
        libz.so.1 => /lib/libz.so.1 (0x7f8b00b35000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x7f8b00b2e000)
        libmount.so.1 => /lib/libmount.so.1 (0x7f8b00adc000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x7f8b00ad7000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x7f8b00acf000)
        libXi.so.6 => /usr/lib/libXi.so.6 (0x7f8b00abe000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0x7f8b00ab2000)
        libwayland-server.so.0 => /usr/lib/libwayland-server.so.0 (0x7f8b00aa1000)
        libfribidi.so.0 => /usr/lib/libfribidi.so.0 (0x7f8b00a84000)
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x7f8b0098a000)
        libpng16.so.16 => /usr/lib/libpng16.so.16 (0x7f8b0095a000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x7f8b0091b000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x7f8b00868000)
        libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x7f8b0085b000)
        libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x7f8b00856000)
        libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x7f8b007c7000)
        libp11-kit.so.0 => /usr/lib/libp11-kit.so.0 (0x7f8b006e2000)
        libidn2.so.0 => /usr/lib/libidn2.so.0 (0x7f8b006b0000)
        libunistring.so.5 => /usr/lib/libunistring.so.5 (0x7f8b0050a000)
        libtasn1.so.6 => /usr/lib/libtasn1.so.6 (0x7f8b004f8000)
        libnettle.so.8 => /usr/lib/libnettle.so.8 (0x7f8b004af000)
        libhogweed.so.6 => /usr/lib/libhogweed.so.6 (0x7f8b00469000)
        libgmp.so.10 => /usr/lib/libgmp.so.10 (0x7f8b00402000)
        libblkid.so.1 => /lib/libblkid.so.1 (0x7f8b003b9000)
        libbsd.so.0 => /usr/lib/libbsd.so.0 (0x7f8b003a6000)
        libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x7f8b00387000)
        libbz2.so.1 => /usr/lib/libbz2.so.1 (0x7f8b00374000)
        libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x7f8b00366000)
        libmd.so.0 => /usr/lib/libmd.so.0 (0x7f8b0035a000)
        libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x7f8b00337000)
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __memcpy_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __memset_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __vsnprintf_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __vfprintf_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __memmove_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __res_ninit: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __res_nclose: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __snprintf_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __fprintf_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __longjmp_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __mbrlen: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: strtoll_l: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: strtoull_l: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: gnu_get_libc_version: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __fdelt_chk: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __sched_cpualloc: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __sched_cpufree: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: initstate_r: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: random_r: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __register_atfork: symbol not found
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/chrome: __libc_stack_end: symbol not found

Next command doesn't throw errors:

npx --yes @puppeteer/[email protected] launch [email protected]

But the main problem is:

./chrome/linux-116.0.5845.96/chrome-linux64/chrome --no-sandbox --headles --disable-gpu
Error relocating /chrome/linux-116.0.5845.96/chrome-linux64/nacl_helper: _r_debug: symbol not found
[190:190:0919/094650.549691:ERROR:nacl_fork_delegate_linux.cc(313)] Bad NaCl helper startup ack (0 bytes)
[182:198:0919/094650.554237:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[182:182:0919/094650.558103:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY
[182:182:0919/094650.558114:ERROR:env.cc(255)] The platform failed to initialize.  Exiting.
[0919/094650.559778:ERROR:elf_dynamic_array_reader.h(64)] tag not found
[0919/094650.559804:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.559956:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.560025:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.560100:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.560171:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.597906:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.598185:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.598413:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.598748:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.599035:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.599311:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.599510:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
[0919/094650.599658:WARNING:process_reader_linux.cc(95)] sched_getscheduler: Function not implemented (38)
Segmentation fault (core dumped)

@vanodevium
Copy link
Author

@gmile

for my case, I decided to simply install the repository from the community and not have problems

Because taking alpine to save space, but because of all these dependencies get a larger image than taking ubuntu in docker is a little stupid.

@mbrevda
Copy link

mbrevda commented Jan 29, 2024

related (star to upvote!): https://bugs.chromium.org/p/chromium/issues/detail?id=1380656

@thiagowfx
Copy link
Contributor

x-ref to alpine FR: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15279

This would be rather difficult to achieve at the moment though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants