levelup: Error with level on docker

Hi, I’m using level in one of my app, it work nicely when I run it on my mac using nodejs v0.12.2 but when I run it in Docker using the official node image with v0.12.2 I have this error when I launch the app.

scrap_1 | /app/node_modules/level/node_modules/leveldown/node_modules/bindings/bindings.js:83
scrap_1 |         throw e
scrap_1 |               ^
scrap_1 | Error: /app/node_modules/level/node_modules/leveldown/build/Release/leveldown.node: invalid ELF header
scrap_1 |     at Error (native)
scrap_1 |     at Module.load (module.js:355:32)
scrap_1 |     at Function.Module._load (module.js:310:12)
scrap_1 |     at Module.require (module.js:365:17)
scrap_1 |     at require (module.js:384:17)
scrap_1 |     at bindings (/app/node_modules/level/node_modules/leveldown/node_modules/bindings/bindings.js:76:44)
scrap_1 |     at Object.<anonymous> (/app/node_modules/level/node_modules/leveldown/index.js:1:99)
scrap_1 |     at Module._compile (module.js:460:26)
scrap_1 |     at Object.Module._extensions..js (module.js:478:10)
scrap_1 |     at Module.load (module.js:355:32)
soccerscrap_scrap_1 exited with code 1

I search where the error can come from but I don’t find anything

Thanks for your help.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

When Docker build the image following my Dockerfile it add the package.json in the container and run npm install :

ADD package.json /app/
RUN npm install

So now I have a node_modules in my container, and after that I add all my current directory in the container :

ADD . /app/

And here is the problem because in my current directory I already had a node_modules directory so when I add it I overwrite the node_modules directory that is in the container.

So I have to ignore my node_modules diretory with the .dockerignore file

@mcollina Thanks a lot ! It worked ! I didn’t know the existence of the .dockerignore file ! Thanks @ralphtheninja for your help !