2

Caveat, I am running npm install from within a Docker container that is being used as a Jenkins build slave but I have established that the npm cache is not corrupted and is being stored in a volume persisted across container runs and rms, you can see that proof here

When I run npm cache ls many packages from my package.config are listed: enter image description here

And yet, every time I run npm install or npm --skip-installed --cache-min 9999999 install every single package is installed.

  • The environment is is a Centos7 docker container
  • node --version 6.11.4
  • npm --version 3.10.10

When I run npm install twice on my localhost Windows 10 machine, same node version and npm version, the cache is clearly used the second time npm install is ran: enter image description here

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
  • Possible duplicate of [How to cache the RUN npm install instruction when docker build a Dockerfile](https://stackoverflow.com/questions/35774714/how-to-cache-the-run-npm-install-instruction-when-docker-build-a-dockerfile) – 030 Nov 26 '17 at 17:44

1 Answers1

0

I was able to solve my issues of caching NPM packages in a Docker container here: https://devops.stackexchange.com/a/2936/4790

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176