We’ve been using Docker 1.12 (for Mac) to set up a front-end development pipeline. We found that NPM runs very slowly, if at all. This specific version of Docker has a Docker (virtual) machine behind the scenes, which is installed with the regular Docker installation.
To solve the problem, in our Dockerfile we need to configure NPM settings:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install --reinstall -y ca-certificates && \
update-ca-certificates && \
curl -sL https://deb.nodesource.com/setup_4.x | bash
RUN npm config set registry http://registry.npmjs.org/ && \
npm config set strict-ssl false && \
npm config set maxSockets 8 && \
npm install --unsafe-perm --allow-root --ignore-scripts -d
# ...
|