This is a reproduction of the performance issue running npm install
in a Docker container with NPM 7.
Issues on npm/cli repositories
Timings in seconds from GitHub actions run reported by time
command:
Docker node:14.17.6 |
Docker node:16.9.1 |
Docker node:14.17.6-alpine |
Docker node:16.9.1-alpine |
Local Node 14.17.6 | Local Node 16.9.1 | ||
---|---|---|---|---|---|---|---|
npm@7.24.0 i |
real user sys |
140.73 143.66 68.16 |
128.99 118.99 45.49 |
150.36 145.09 66.08 |
163.99 139.65 76.43 |
74.526 75.698 10.581 |
67.379 66.108 9.808 |
npm@7.24.0 i --legacy-peer-deps |
real user sys |
141.48 136.63 58.41 |
153.14 132.21 58.17 |
121.43 124.17 62.29 |
158.33 143.17 76.08 |
61.892 63.315 8.508 |
81.233 66.614 8.595 |
npm@6.14.15 i |
real user sys |
59.06 58.23 12.44 |
67.86 63.17 12.14 |
60.94 64.26 13.07 |
59.80 61.39 13.69 |
61.310 60.126 11.312 |
61.416 58.122 9.296 |
From the times it is clearly visible that an npm@7 install
on Docker takes significantly (~ 2x) longer than locally. An npm@6 install
on Docker does not have this performance issues.
This is not an GitHub actions specific problem, I can also reproduce this behavior on Windows using Docker Desktop with WSL2 and on my Ubuntu 20.04 server.