2

I'm making a web service in NodeJs that needs to support a specific xml request. So I'm using libxmljs to parse xml and validate it against an xsd.

On my Windows machine everything works well, so when doing this:

isValid = xml.validate(xsd)

isValid will be set as a boolean and xml will have items in the property validationErrors. Everything is fine until I run it in a docker container running node:10.15.2-alpine.

As long as the validation passes, everything is fine, but when there are validation errors, the entire docker container crashes.

I could not find an answer to this when googling so I will provide the answer myself :-)

TBear
  • 93
  • 1
  • 7

2 Answers2

1

Change in your Dockerfile to use FROM node:10.15.2-slim and not FROM node:10.15.2-alpine.

Yes it uses more space, but the alpine edition is appearently not compatible with some of the prebuild python libraries the libxmljs uses.

TBear
  • 93
  • 1
  • 7
  • Hi ,I am also facing same issue ,but my docker file complete different ,looks like FROM hub.docker.hpecorp.net/global-it/addison-nodejs:3.0.0 can you help me here? What I can change here? – Santosh Khavekar May 27 '19 at 06:57
  • No, I don't know about that, but if you found a solution, feel free to post it here :-) – TBear Jul 09 '19 at 07:05
  • I had the same issue and tried the node:10.15.2-slim image: got the very same /usr/src/app/node_modules/libxmljs/build/Release/xmljs.node: invalid ELF header error message again. I'll try with some other images and see if I can get passed that problem. :-( – MetaZebre Sep 23 '20 at 12:21
0

I faced the same problem, I was able to resolve it for some of the alpine distributions by installing python, g++ and make.

apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python && apk add --update --no-cache g++ && apk add --update --no-cache make
TalR
  • 21
  • 1
  • 5