Reputation: 1899
I have a Docker container that I've been using for quite some time for a node application which depends on headless chrome. This container has always worked up until just now, without changing anything.
The container builds fine, but chromium has an error when it is started within the container:
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_mRKS3_: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt19_Sp_make_shared_tag5_S_eqERKSt9type_info: symbol not found
Here's my Dockerfile:
FROM keymetrics/pm2:latest-alpine
# Install git
RUN apk --no-cache upgrade
RUN apk --no-cache add git
# Install chromium
RUN apk -U --no-cache \
--allow-untrusted add \
zlib-dev \
chromium \
xvfb \
wait4ports \
xorg-server \
dbus \
ttf-freefont \
grep \
udev \
&& apk del --purge --force linux-headers binutils-gold gnupg zlib-dev libc-utils \
&& rm -rf /var/lib/apt/lists/* \
/var/cache/apk/* \
/usr/share/man \
/tmp/* \
/usr/lib/node_modules/npm/man \
/usr/lib/node_modules/npm/doc \
/usr/lib/node_modules/npm/html \
/usr/lib/node_modules/npm/scripts
ENV CHROME_BIN=/usr/bin/chromium-browser
ENV CHROME_PATH=/usr/lib/chromium/
# Bundle app files
ADD ./dtms-api-service /server/dtms-api-service
ADD ./dtr-omnicache /server/dtr-omnicache
ADD ./dtr-webservice /server/dtr-webservice
ADD ./env.json /env.json
ADD ./env-dev.json /env-dev.json
ADD ./ecosystem.config.js /ecosystem.config.js
# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN cd /server/dtms-api-service && npm install
RUN cd /server/dtr-omnicache && npm install
RUN cd /server/dtr-webservice && npm install
EXPOSE 3001
ENV PM2_PUBLIC_KEY <secret>
ENV PM2_SECRET_KEY <secret>
CMD ["sh", "-c", "chromium-browser --headless --disable-gpu --no-sandbox --disable-software-rasterizer --remote-debugging-port=9222 & pm2-runtime start ecosystem.config.js --env production"]
I've also tried using this to install chrome but it makes the same result:
# Install chromium
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium@edge \
nss@edge
As well as:
# Install chromium
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& apk add --no-cache \
chromium@edge \
harfbuzz@edge \
nss@edge \
freetype@edge \
ttf-freefont@edge \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk
EDIT: So it turns out that Chromium was updated on the APK repository on the 25th of September, which would line up with the time it stopped working. So now I have to figure out how to get it working again or switch to the older version.
I tried installing the previous version using:
RUN echo @v3.10 http://nl.alpinelinux.org/alpine/v3.10/main >> /etc/apk/repositories \
&& echo @v3.10 http://nl.alpinelinux.org/alpine/v3.10/main >> /etc/apk/repositories \
&& apk add --no-cache \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk
And now with this I get a segmentation fault when running the chromium-browser
command.
Upvotes: 6
Views: 5849
Reputation: 1186
Also bumped into this one few days ago. I suspect the edge version of chrome is broken. Historically the reason for me to using that was because of the new --headless
option. But the stable build is currently at 77.0.3865.75-r0, which is more than enough for everything I needed. So my Dockerfile
now looks like this:
...
RUN apk update && apk upgrade && \
apk add --no-cache \
chromium
...
The use-case for me is to build EmberJS app and test it against Chrome in headless mode.
Before this change my Dockerfile
that was not longer working for me was:
RUN apk update && apk upgrade && \
echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
apk add --no-cache \
git \
chromium@edge \
nss@edge \
freetype@edge \
harfbuzz@edge && \
rm -rf /var/lib/apt/lists/* \
/var/cache/apk/* \
/usr/share/man \
/tmp/*
And the error was:
Error: Browser exited unexpectedly
Non-zero exit code: 127
Stderr:
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt19_Sp_make_shared_tag5_S_eqERKSt9type_info: symbol not found
Upvotes: 4