B Y T E B A R

Study Hub / Docker Certified Associate (DCA) / Domain 2.0

Docker Certified Associate (DCA) Domain 2.0: Image Creation, Management, and Registry — Explained

Domain 2.0 is about the artifacts of Docker: how images are built from Dockerfiles, how layers make them efficient, and how registries store and distribute them. The image is the unit of Docker — understand it deeply.

Exam weight: 20% · Free study preview from ByteBar

Dockerfiles: recipes for images

Layers, tags, and image anatomy

Dockerfile instruction → image layer. Container = image + thin writable layer. Layers are why Docker is fast: build once, share everywhere, change little.

Registries: where images live

The must-memorize table: Dockerfile instructions

What each instruction does.

InstructionDoesNotes
FROMSets the base imageFirst instruction; defines the starting layers
RUNExecutes a command at build timeEach RUN is a layer — combine with && where sensible
COPY / ADDCopies files into the imageCOPY is preferred; ADD has magic (tar/URL) you rarely want
WORKDIRSets the working directoryCreates it if missing; prefer over cd
ENVSets environment variablesBaked into the image — not for secrets
EXPOSEDocuments which ports the app usesDocumentation + inter-container discovery; doesn't publish
CMD / ENTRYPOINTDefault command at container startENTRYPOINT is harder to override; CMD is the default args

Try it: 4 sample questions

Sample questions to check your understanding of this domain. Answers and full reasoning are tucked under each one.

1. A Dockerfile installs dependencies (slow, rarely changes) and then copies application code (fast, changes constantly). Why does the order matter?

  1. A. A. It doesn't — Docker rebuilds everything every time
  2. B. B. Layer caching: unchanged early layers are reused, so putting stable steps first makes rebuilds fast
  3. C. C. COPY must always be the last instruction by law
  4. D. D. RUN instructions can't come before COPY
Show answer & reasoning

B. Docker caches each layer and reuses it when the instruction and its inputs haven't changed. Dependencies-first means code changes only rebuild the last layers — seconds instead of minutes. Reverse the order and every code tweak reinstalls all dependencies. Order is performance.

2. A team's builds include the full JDK and build tools, producing 1.2GB production images. What is the standard fix?

  1. A. A. Buy bigger registry storage
  2. B. B. Multi-stage builds — compile in a builder stage, copy only the artifact into a slim runtime image
  3. C. C. Compress the image with gzip manually
  4. D. D. Use :latest tags
Show answer & reasoning

B. Multi-stage builds separate build-time needs (JDK, compilers) from runtime needs (JRE + app): the final image carries only what runs. Smaller images pull faster, scan faster, and expose less attack surface. Storage (A) treats the symptom.

3. Two teams push different images that both start FROM the same base image. How much extra disk does the second image's base layers consume?

  1. A. A. A full second copy
  2. B. B. Nothing extra — identical layers are stored once and shared
  3. C. C. Half, due to compression
  4. D. D. It depends on the tag name
Show answer & reasoning

B. Layers are content-addressed: identical layer = identical hash = stored once, referenced twice. This sharing is why a host with 50 images isn't 50× the base size — and why standardizing base images pays off in disk, pull time, and scanning.

4. A developer accidentally committed AWS keys into a Dockerfile ENV line and pushed the image to a registry. What are the two failures?

  1. A. A. ENV is deprecated; keys belong in CMD
  2. B. B. Secrets baked into image layers are permanent and distributed — use build secrets / runtime injection instead
  3. C. C. Registries can't store ENV variables
  4. D. D. AWS keys don't work in containers
Show answer & reasoning

B. Image layers are forever: anyone who pulls the image (now or from any cache/mirror) gets the keys, and "deleting" the line later doesn't purge existing copies. Secrets must arrive at runtime (mounted secrets, env from orchestrator) — never baked into layers. Rotate the keys immediately.

This was one domain. The simulator drills all 6.

This free preview covered Images & Registry (Domain 2.0, 20%). Not covered here: Orchestration (Domain 1.0, 25%); Security (Domain 5.0, 15%). Swarm orchestration and Docker security — the most scenario-heavy DCA material — stay in the paid guide and practice bank. The ByteBar Practice Exam Simulator drills every domain with 1,000 exam-style questions — $9.99 one-time unlocks all 28 exams. Prefer to read? The full DCA Study Guide is in the ByteBar shop on Etsy.

Practice Exam Simulator — $9.99 one-time, all 28 exams Full Study Guides on Etsy
Keep learning: ByteBar blog · ByteBar store