Docker mediasoup-worker error

Hello There,

First question after reading quite a few comments on this topic. As far as I understand, the issue is that the pre-built binary expect a different O/S. How do you get this fixed, or should build be done in the docker continer?

Dockerfile looks partially like:
FROM node:16
RUN apt -y update
RUN apt -y install python3-pip
COPY . /opt/SFU
RUN npm update
RUN npm install .

Then run the container like:

docker run -it --entrypoint /bin/bash 123456abcdef

/opt/SFU/node_modules/mediasoup_prebuilt/worker/out/Release/mediasoup-worker
/opt/SFU/node_modules/mediasoup_prebuilt/worker/out/Release/mediasoup-worker: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29’ not found (required by /opt/SFU/node_modules/mediasoup_prebuilt/worker/out/Release/mediasoup-worker)

ldd also show this image. The host operating system on what Dockerimage is built is the same where I am running now - it is an ubuntu 20.04.
So, how is it supposed to work “FROM node:” - or is it mandatory to make mediasoup working to have “FROM ubuntu:” in docker? Or, when using node as base, does mediasoup need a rebuild from source?

Do you copy it into another container then (like one based on Alpine)?
If so, don’t, you need to run on the same distro as it was compiled, executable isn’t fully static.
Also make sure you don’t copy node_modules with COPY (add it to .dockerignore file).

.dockerignore sounds like a good idea!

Hmm, I added .dockerignore and the node_modules directory does not exist when the docker container is started.
npm install creates the directory and the same error is happening as before. The container is not copied anywhere.

Ah, I remember something similar.

This is because you’re using container image with newer glibc on an old distro/Docker. Try to update your OS to the latest version and install latest Docker release and the issue should go away. You will get similar errors with other apps, it is not specific to mediasoup.

You are right. FROM node:16 changed to FROM node:latest and it works like a charm.