Skip to content

Instantly share code, notes, and snippets.

@laysent
Last active December 2, 2019 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laysent/b12faceac4bcf10bee04aabfa505c244 to your computer and use it in GitHub Desktop.
Save laysent/b12faceac4bcf10bee04aabfa505c244 to your computer and use it in GitHub Desktop.
Docker node-alpine with 7zip-bin

Updated

After linking the dynamic dependency, 7zip-bin now works in alpine docker.

For details explanation, check this GitHub issue.

Original

When running 7zip-bin inside alpine docker, it produces error of "file not found". Here is the way to reproduce it:

  1. compile the docker image with: docker build -f Dockerfile -t example .
  2. run the docker with: docker run --rm example

console should produce the following issue:

/run.sh: line 2: /example/node_modules/7zip-bin/linux/x64/7za: not found
FROM node:10-alpine
RUN mkdir -p example && \
cd example && \
yarn init -y && \
yarn add 7zip-bin && \
mkdir /lib64 && \
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
ADD run.sh /run.sh
RUN chmod +x /run.sh
CMD ["/run.sh"]
cd example
$(node -e "console.log(require('7zip-bin').path7za)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment