← Quiz: Docker and Containers: all 10 questions
Quiz: Docker and Containers · Question 3 of 10
Why copy package.json and run npm ci before copying the rest of the code?
Why copy package.json and run npm ci before copying the rest of the code?
- A.npm requires it
- B.So the dependency layer is cached and reused when only source code changes
- C.To make the image larger
- D.To run as root
Answer & explanation
Correct answer: So the dependency layer is cached and reused when only source code changes
Layer caching makes rebuilds after code changes much faster.
Can you get the rest right without peeking?
Take the timed Quiz: Docker and Containers quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →