<p>First off, I am totally new to deploying CICD builds.</p>

<p>I started with a successful setup of Jenkins X on an AWS EKS Cluster via this 
<a href="https://aws.amazon.com/blogs/opensource/continuous-delivery-eks-jenkins-x/#" rel="nofollow noreferrer">guide</a>.</p>

<p>I am able to run the pipeline via GitHub and builds successfully on a normal jx quickstart.</p>

<p>Problems arose when I started pushing my node express application.</p>

<p>On an alpine node base, my dockerfile looked like this:</p>

<pre><code>FROM node:10.15.3-alpine
RUN mkdir -p /app/node_modules &amp;&amp; chown -R node:node /app
WORKDIR /app
COPY package*.json ./
RUN npm ci --prod
FROM alpine:3.7
COPY --from=0 /usr/bin/node /usr/bin/
COPY --from=0 /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/
WORKDIR /app
COPY --from=0 /app .
EXPOSE 3000
CMD ["node", "server.js"]
</code></pre>

<p>And it terminated with an error:</p>

<pre><code>Step 5/14 : RUN npm ci --prod
 ---&gt; Running in c7f038a80dcc
[91mnpm[0m[91m ERR! code EAI_AGAIN
[0m[91mnpm ERR! errno EAI_AGAIN
[0m[91mnpm ERR![0m[91m request to https://registry.npmjs.org/express/-/express-4.16.4.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
[0mtime="2019-03-28T08:26:00Z" level=fatal msg="build failed: building [community]: build artifact: The command '/bin/sh -c npm ci --prod' returned a non-zero code: 1"
</code></pre>

<p>I tried using a non alpine base and this was how it looked:</p>

<pre><code>FROM node:10-slim
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
ENV PORT 3000
EXPOSE 3000
CMD ["npm", "start"]
</code></pre>

<p>But then, the problem was the build hangs (or is taking very long) when it hits the RUN npm install step.</p>

<p>I have scoured for possible answers and duplicate questions but to no avail. So I last resorted into asking it here.</p>

<p>I don't have an idea of what's going on honestly.</p>

<p>I managed to solve this issue by enabling docker bridge network when bootstrapping EKS worker nodes.</p>

<pre><code>#!/bin/bash
set -o xtrace
/etc/eks/bootstrap.sh --enable-docker-bridge true 'your-cluster-name'
</code></pre>

<p>More detail in this Github issue: <a href="https://github.com/awslabs/amazon-eks-ami/issues/183" rel="nofollow noreferrer">https://github.com/awslabs/amazon-eks-ami/issues/183</a></p>
