Docker: Npm installs very slowly on Ubuntu host

I have 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 pm2@0.14.0

      

In the last step, npm install takes too long to install the package (~ 55 minutes). How can I improve the speed of my npm install and get feedback from the install and not look like it's been hung?

Note:

I am getting the following warning during npm install

npm WARN optional dep failed, continuing fsevents@0.3.6

      

and sometimes a mistake

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

      

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

Update:

I faced the above issue on Ubuntu 14.04. When I tried to build the same Dockerfile on Windows 8.1 using boot2docker, it is very fast (~ 2 minutes). This raises the question; what configuration am i missing in Ubuntu?

+3


source to share





All Articles