Skip to content
tezvyn:

Docker & Kubernetes

Containers, Helm, orchestration, service mesh

144 bites

Test yourself: Top 30 Docker & Kubernetes interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Interview questions in Docker & Kubernetes

easy1 min read

What is a container vs a VM?

Containers share the host kernel and isolate via namespaces and cgroups; VMs run a full guest OS on a hypervisor; containers are lighter and faster.

How do Docker images and containers differ and relate?
easy2 min read

How do Docker images and containers differ and relate?

This tests your grasp of the immutable template versus mutable runtime boundary. A good answer: an image is a read-only layered template with code and dependencies; a container is a runnable instance with a writable layer on top.

Name three Linux namespaces and explain what each one isolates.
intermediate2 min read

Name three Linux namespaces and explain what each one isolates.

Name three of PID, Network, Mount, UTS, IPC, User, Cgroup, Time; say what each hides; cite CLONE_NEW* or /proc/pid/ns.

intermediate2 min read

How do containers enforce CPU and memory limits via cgroups?

Cover CPU CFS quota and shares, memory limits and OOM, and runtime cgroup config.

intermediate2 min read

Describe the relationship between containerd and runc in starting a container.

Tests the OCI runtime split and lifecycle ownership. A great answer states containerd handles image pull, storage, and API lifecycle, then invokes runC to spawn the isolated process.

intermediate2 min read

Explain layered filesystems like OverlayFS and their efficiency vs monolithic models

This tests copy-on-write layering and deduplication in container storage. A strong answer covers lowerdir/upperdir/merged mounts, layer reuse across images, and why diff-based distribution beats monolithic blobs.

advanced1 min read

What is the OCI and why do its specs matter?

OCI defines vendor-neutral specs for image format and runtime so any compliant tool interoperates; runc implements the runtime spec; this prevents lock-in.

advanced1 min read

Trace a container process's syscalls from the host

Find the host PID via docker inspect or ps, then strace -p that PID from the host, since the container shares the host kernel.

easy1 min read

Build, tag, and run a container with port mapping

Docker build -t my-app:1.0 . to build and tag; docker run -d -p 8080:80 my-app:1.0 to run detached with host:container port mapping.

easy1 min read

Dockerfile COPY versus ADD

COPY just copies local files; ADD also auto-extracts local tarballs and can fetch remote URLs; prefer COPY for predictability, use ADD for local archive extraction.

easy1 min read

Dockerfile CMD versus ENTRYPOINT

ENTRYPOINT sets the fixed executable; CMD sets default args or the default command; run-time args override CMD but append to ENTRYPOINT. Use together to make a fixed binary with overridable defaults.

intermediate1 min read

Optimize Dockerfile layer caching for npm install

Copying all source first invalidates the npm install layer on any code change; instead copy package.json and lockfile, run npm install, then copy the rest.

intermediate1 min read

Multi-stage builds for compiled languages

Build in a stage with the full toolchain, then COPY --from only the artifact into a tiny final base, shrinking image size and attack surface.

intermediate1 min read

Debug a running container with the Docker CLI

Docker inspect for full state and config, docker logs -f to follow output live, docker exec -it <id> sh or bash for an interactive shell.

intermediate1 min read

What is a dangling image and how to prune it

A dangling image is an untagged layer (<none>:<none>) orphaned when a tag moves to a rebuilt image; list with docker images -f dangling=true, remove with docker image prune.

advanced1 min read

Run a container as a non-root user

Create a dedicated group and user, chown app files to them, then USER to drop privileges before the process runs.

advanced1 min read

Pass build-time secrets securely with BuildKit

Use BuildKit RUN --mount=type=secret (or type=ssh) so the secret is mounted only during that step and never written to a layer; pass it with --secret at build time.

advanced1 min read

Distroless images: benefits and trade-offs

Distroless ships only the app and runtime deps, no shell or package manager; smaller and a smaller attack surface than Alpine; trade-off is harder debugging with no shell.

easy1 min read

Start Compose services detached and view one service's logs

Docker compose up -d starts everything detached; docker compose logs -f web follows only the web service's logs.

easy1 min read

Persist PostgreSQL data across compose down

Define a named volume and mount it at the database's data directory (/var/lib/postgresql/data); named volumes survive compose down.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles