Docker Community Forums

Share and learn in the Docker community.

Yarn install failing for apline docker


(Bbalakrishnan) #1

We are using alpine linux (8.5.0-alpine) to build a custom docker image which is having node custom modules installed using the package.json file and yarn. The build was working perfect till last week and we did the patching of host machine (yum updates) and host packages for updated after that the build started failing for these node modules installation . We are not able to find out which package in the host machine is creating issue inside docker which installing node modules. If we try to install the same node modules in host will get the same error there as well. Initially i was thinking that it is related to kernel since the host and docker container is shares the same kernel and it got upgraded during the patching. I tried using the old kernel as well but still not able to resolve the issue. So some package or driver in the host machine is creating the issue but not able to figureout which package.

Command is failing in “RUN yarn install”.

Sample contents in Docker file.

FROM node:8.5.0-alpine
WORKDIR /src
RUN apk --update add autoconf automake build-base libtool nasm libpng-dev python bash git nginx curl

RUN npm install -g yarn

Only dependency management files first

ADD package.json /src/package.json
ADD yarn.lock /src/yarn.lock

#ADD node_modules .

Install dependencies, skip postInstall

RUN yarn install

Copy everything now (Except .dockerignore files)

COPY . .

Build assets for production

RUN yarn run build


Below is the error . it fails during the node module installation. Let me know if anyone have faced similar issue and how you fixed it. Thanks in advance.

OS version : Red Hat Enterprise Linux Server release 7.4 (Maipo)
OS Kernel Version: 3.10.0-693.17.1.el7.x86_64
Docker version : Server Version: 1.13.1


[91merror An unexpected error occurred: "/src/node_modules/pngquant-bin: Command failed.
Exit code: 1
Command: sh
Arguments: -c node lib/install.js
Directory: /src/node_modules/pngquant-bin
Output:
internal/child_process.js:323
throw errnoException(err, ‘spawn’);
^

Error: spawn Unknown system error -8
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at exports.spawn (child_process.js:502:9)
at /src/node_modules/bin-check/index.js:22:12
at /src/node_modules/executable/index.js:27:4
at FSReqWrap.oncomplete (fs.js:153:5)".
[0minfo If you think this is a bug, please open a bug report with the information provided in “/src/yarn-error.log”.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Service ‘web’ failed to build: The command ‘/bin/sh -c yarn install’ returned a non-zero code: 1
Build step ‘Execute shell’ marked build as failure
Triggering a new build of Sprucebot-Purge-Docker-Images
Finished: FAILURE