question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alpine support - musl libc

See original GitHub issue

I’m getting the following error while attempting to run the example on alpine.

/var/www/node_modules/bindings/bindings.js:83
        throw e
        ^

Error: Error relocating /var/www/node_modules/ibm_db/build/Release/../../installer/clidriver/lib/libdb2.so.1: pthread_mutexattr_setkind_np: symbol not found
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at bindings (/var/www/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/var/www/node_modules/ibm_db/lib/odbc.js:27:31)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)

The file does exist at: /var/www/node_modules/ibm_db/installer/clidriver/lib/libdb2.so.1.

Source: Dockerfile

FROM node:7-alpine

RUN apk add --no-cache --virtual .build-deps \
    python make g++

RUN mkdir /var/www \
    && cd /var/www \
    && npm install ibm_db

RUN apk del .build-deps

RUN apk add --no-cache --virtual .odbc-rundeps \
        libgcrypt \
        linux-pam \
        libxml2 \
    && ln -s -f /usr/lib/libgcrypt.so.20 /usr/lib/libcrypt.so.1

COPY ./app.js /var/www/

CMD [ "node", "/var/www/app.js" ]

app.js

var ibmdb = require('ibm_db');

ibmdb.open("DATABASE=Test;HOSTNAME=*******;UID=******;PWD=******;PORT=446;PROTOCOL=TCPIP", function (err,conn) {
	if (err) return console.log(err);

	conn.query('***********', function (err, data) {
		if (err) console.log(err);
		else console.log(data);

		conn.close(function () {
			console.log('done');
		});
	});
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:31 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
tatemzcommented, Feb 21, 2019

It’s prolly a good idea to support musl Alpine environment… It’s really tiny and awesome

3reactions
stijwilliamscommented, Aug 27, 2020

Another +1 for alpine support… If your goal is to build secure containers, ubuntu and debian fail to meet the requirement with all the bloat they include.

Install scan tools

See https://github.com/aquasecurity/trivy

RUN apk add curl
&& curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s – -b /usr/local/bin
&& trivy --no-progress --download-db-only

This will fail the docker image build if there are problems

RUN trivy filesystem --exit-code 1 --no-progress /

^^ This is secure, run the same on the other base images, and you will see all sorts of security vulnerabilities.

Read more comments on GitHub >

github_iconTop Results From Across the Web

musl - Alpine Linux packages
Package, musl. Version, 1.2.3-r4. Description, the musl c library (libc) implementation. Project, https://musl.libc.org/. License, MIT.
Read more >
Musl LibC Support · Issue #918 · oven-sh/bun - GitHub
What is the problem this feature will solve? It will allow bun to be used in linux distributions such as Alpine Linux or...
Read more >
Projects using musl
Alpine Linux - based on musl since the 3.0 release. ... Supports 17 different CPU architectures; Has merged /usr for better compatibility ...
Read more >
musl-libc - Alpine's Greatest Weakness - LinkedIn
The Alpine Linux distribution has gained traction in the Docker deployment world for producing compact small disk footprint containers.
Read more >
I've definitely had my share of annoyances with musl-libc and ...
We had to stop using alpine because we have to resolve a DNS name that resolved in a 100 hosts. Musl fails to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found