Docker: Npm install very slow in Ubuntu host

4.8k Views Asked by At

I created a Dockerfile for my application as shown below

FROM ubuntu:14.04
MAINTAINER Shaun Thomas

RUN echo "deb http://de.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse" > /etc/apt/sources.list
RUN apt-get update -y

RUN apt-get install -y curl software-properties-common git

RUN mkdir /nodejs && curl http://nodejs.org/dist/v0.10.38/node-v0.10.38-linux-x64.tar.gz | tar xvzf - -C /nodejs --strip-components=1
ENV PATH $PATH:/nodejs/bin

RUN npm install -g [email protected]

At the last step, npm install takes too long time to install the package (~ 55mins). How can I improve npm install speed and get a feedback of installation rather than seeming like it is hanged?

Note:

I get the following warning during the npm install

npm WARN optional dep failed, continuing [email protected]

and sometimes error

npm ERR! fetch failed https://registry.npmjs.org/yargs/-/yargs-1.3.3.tgz

I know that Docker build process is I/O intensive. I am using HDD and not SSD. I am looking for a solution other than changing my HDD to improve the npm install speed.

Update:

I am facing the above problem in Ubuntu 14.04. When I tried to build the same Dockerfile in Windows 8.1 using boot2docker, it is super fast (~2 minutes). This brings up the question; what configuration am I missing in Ubuntu?

0

There are 0 best solutions below