Docker Build doesn't work inside AWS EKS's worker nodes

9/11/2019

In my local machine, I can build the image from the Dockerfile of my Nodejs Project. But I cloned that project inside AWS EKS's worker node and tried to build the image but it did not work. (Note: *the reason that I ran the docker build on a worker node, previous I tried to build an image inside Jenkins and it gives the same result as what I got the error inside worker nodes*).

Error:

docker build -t crmproxy .

Sending build context to Docker daemon  1.451MB

Step 1/9 : FROM node:8
 ---> c83f74dcf58e
Step 2/9 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 1f9b76a60013
Step 3/9 : COPY package*.json ./
 ---> b2ca6505fed4
Step 4/9 : RUN npm install
 ---> Running in 39aae0cbd868
[91mnpm ERR! cb() never called!
[0m[91m
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

First time when I got this error, I googled this error, I thought it was because of ULIMIT not enough. But It could not fix that error by increasing ULIMIT. This my previous StackOverflow Question

So that's why I tried to test docker build in worker nodes. inside EKS worker nodes, im getting the same error. I can build the image in my local machine and normal ec2 instances where docker installed.

Dockerfile :

FROM node:8

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3002

CMD npm start

Any help would be appreciated!

-- Sarasa Gunawardhana
amazon-ec2
amazon-web-services
aws-eks
docker
kubernetes

1 Answer

9/11/2019

Try using this dockerfile

FROM node:8

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm cache verify && npm install

COPY . .

EXPOSE 3002

CMD npm start

if still not work try clearing npm cache clean -f & npm update i think it's npm version issue may be.

you can update the npm using npm i -g npm

-- Harsh Manvar
Source: StackOverflow