Docker Quiz
Test your Docker fundamentals - images, layers, networks, security.
Sample questions
EXAMPLE
# Docker quiz 1) The default layer cache key for a RUN instruction includes: a) the RUN command and the previous layer ID b) the file mtimes in the build context c) the host kernel version d) nothing - it always rebuilds 2) Which choice keeps an image smallest? a) FROM ubuntu:latest b) FROM alpine c) FROM scratch (for static binaries) or distroless (for runtimes) d) FROM debian:bullseye 3) Inside a container, PID 1 has special behaviour. What goes wrong if you forget that? a) signals do not propagate; the app does not shut down cleanly b) the kernel panics c) network breaks d) the container cannot be inspected 4) docker compose down -v will: a) stop containers only b) stop containers AND remove named volumes (destructive) c) restart the daemon d) prune images 5) BuildKit cache mounts persist across builds. Which line uses one? a) RUN apt-get install b) RUN --mount=type=cache,target=/root/.npm npm ci c) COPY --from=build d) ARG BUILDKIT=1 6) Multi-stage builds reduce final image size by: a) compressing it b) copying only the artefacts you need from earlier stages c) deduping layers d) using gzip 7) HEALTHCHECK affects what for orchestrators? a) nothing b) marks the container unhealthy if probe fails - Kubernetes ignores it; Compose and ECS use it c) restarts the host d) it is mandatory 8) Running the docker socket inside a container is: a) safe b) effectively root on the host - never expose to untrusted code c) blocked by default d) required for compose Answers: 1a, 2c, 3a, 4b, 5b, 6b, 7b, 8b.
Why it matters
Docker fundamentals come down to layers (cache), images (small + signed), and security (rootless + no socket inside). If you nail those three, the rest is orchestration.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Discussion
Loading…