🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.npm requires it
  2. B.So the dependency layer is cached and reused when only source code changes
  3. C.To make the image larger
  4. 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 →