Level 2 exam — harder

Exam — fresh questions

2.1 · Recall

1. In a Dockerfile, what does RUN do compared to CMD?

RUN = building (installing), CMD = running (starting) on every run.
2.1 · Application

2. Idir writes his first Node Dockerfile. Which order is correct?

Base, folder, code, install at build time, declared port, launch at run time.
2.1 · Application

3. Idir's build fails. Where does he look first?

The last step is to blame: missing dependency, typo, network.
2.2 · Recall

4. Why place dependencies BEFORE the code in a Dockerfile?

Stable first (cached), changing after (replayed alone).
2.2 · Application

5. Idir's image exceeds 1 GB with the SDK shipped to prod. What does he do?

Build fat, ship lean: only the runnable reaches the final image.
2.2 · Arbitration

6. Idir hesitates between optimizing by gut feeling or measuring. What do you advise?

Optimize what you measure: total size + weight per layer.
2.3 · Application

7. Idir publishes the tested 1.2.0 version. Which sequence is correct?

Tag at build time (account included), authenticate, push, pull elsewhere.
2.3 · Arbitration

8. Idir's prod pulls latest and drifts on every push. Which policy does he enforce?

Prod = frozen, tested tag, never rewritten; latest stays a dev comfort.
2.4 · Recall

9. What is the difference between ARG and ENV?

ARG builds (build), ENV runs (run): do not mix them up.
2.4 · Application

10. Idir serves dev (3000) and staging (8080) with the same 1.0 image. How?

Sane default + -e override: one image, N environments.
2.5 · Application

11. Idir's image runs as root. Which hardening does he apply?

Two lines (dedicated USER) + check: no more default root.
2.5 · Arbitration

12. Idir must handle a sensitive key before a public push. What does he choose?

Zero secrets in the image: injected at run time, never committed, public push is irreversible.
What's next?
Back to the guideGuide contents