Test what you actually know about Docker. Free sample questions below, from easy to hard, with instant explanations.
Compiling an app often needs a whole toolchain (a JDK, npm, build tools) that you don't actually want sitting in your final production image. Multi-stage builds let you use all that tooling in an early, throwaway stage, and then copy over ONLY the finished output into a clean final stage, so the final image ships without any of the bulky build-time dependencies.
Alpine is genuinely small, but it's still a real, complete minimal Linux distribution with its own package manager and shell. Distroless strips even further, down to essentially just your app and its runtime dependencies with nothing else, which is why it typically ends up smaller still.
--memory-swap doesn't set the swap amount on its own, it sets the COMBINED ceiling of memory PLUS swap together. Setting it exactly equal to --memory leaves zero room left over for swap, which is why the container gets OOM-killed the instant its actual RAM usage (RSS) hits that same 512MB number, there was never any swap headroom to fall back on.
Plain system prune only clears out DANGLING images (ones with no tag pointing to them at all), it deliberately leaves alone any image that's still tagged, even if nothing is using it. Adding -a extends the cleanup to ALL unused images, tagged or not, which is why it removes so much more.
USER 1000 changes who the container's processes actually run AS once it's running, from the default root down to an unprivileged UID. That's a real security improvement since a compromised process now has far less it's actually allowed to do on the system.
docker login stores an auth token scoped to the machine it ran on, typically in ~/.docker/config.json, so a developer's laptop being logged in has no bearing on whether the CI runner, a completely separate environment, is authenticated. The fix is to run docker login, or configure an equivalent credential helper or secret, as an explicit pipeline step before pulling from the private registry. Option B is a distractor because a deleted image typically produces a 'not found' style error rather than an authorization error, and options C and D describe restrictions that don't actually exist in Docker.
HEALTHCHECK tells Docker to run a specific command inside the container on a recurring schedule and use its result to decide whether the container counts as 'healthy' or 'unhealthy', it's a status check, not a vulnerability scanner, an auto-restarter, or a metrics exporter on its own.
ARG defines a build-time-only variable, useful for things like a version number or a temporary credential needed during the build, but Docker deliberately does NOT carry it into the running container's environment. If the value is also needed at runtime, it must be explicitly bridged with `ENV API_KEY=$API_KEY` in the Dockerfile. Option B is a common misconception: build args aren't restored at runtime by passing a flag to `docker run`, that flag doesn't even exist for `run`, only for `build`.
SCMP_ACT_ERRNO as the DEFAULT action flips the whole model to deny-by-default: instead of allowing everything except a blocklist, the container can ONLY make the syscalls explicitly listed as allowed, and anything not on that list gets blocked outright rather than silently permitted.
EXPOSE is purely a note left for humans and tooling, 'hey, this app listens on this port', it doesn't actually open anything on the host, configure a firewall, or publish the port itself. Actually making a port reachable from outside still requires the -p flag when you run the container.
Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.