DEV Community

Discussion on: Top 5 Docker Best Practices

Collapse
 
a_chris profile image
Christian

Ehi, how is the cache working? The RUN command executes npm install on the local system so it can use the installed modules to build the image, right?

Collapse
 
schollii profile image
schollii • Edited

No it runs it in the temp container it creates while building.

If the RUN command has not changed from previous docker build, docker pulls in the layer built previous time.

Details in the Docker best practices doc docs.docker.com/develop/develop-im....

Collapse
 
a_chris profile image
Christian

Thank you for the answer!