Interview Q&A · questions with model answers
Docker Interview Questions
Part of the study plan for: DevOps Engineer · Site Reliability Engineer (SRE) · Cloud Engineer · Backend Engineer · Full Stack Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked How does Docker build caching work, and how do you order a Dockerfile to use it well?
Each instruction's result is cached; on rebuild, Docker reuses cached layers until it reaches an instruction whose inputs changed (the instruction text, or for COPY/ADD the checksums of copied…
-
Most asked Volumes, bind mounts and tmpfs: when do you use each?
Named volumes are managed by Docker and are the right choice for persistent container data (databases in development, uploaded files); bind mounts map a host path into the container, ideal for…
-
Most asked How does Docker networking work? Explain bridge, host and user-defined networks.
By default containers attach to a bridge network with private IPs and reach the outside world through NAT; -p 8080:80 publishes a container port on the host. User-defined bridge networks add…
-
How do container logs work in Docker, and how do you stop them filling the disk?
Docker captures each container's stdout and stderr through a logging driver; the default json-file driver writes them to files on the host that grow without limit unless you configure rotation…
-
How do you handle configuration for containers across environments?
Build one image and inject configuration at runtime: environment variables for simple settings, mounted config files for larger ones, and secrets from the platform's secret store. Never build…
-
Explain what happens when you run docker run nginx.
The CLI sends the request to the Docker daemon, which pulls the image from the registry if it is not local (resolving the tag to a digest and downloading missing layers), creates a container…
-
How do you handle time zones, locales and certificates in minimal images?
Minimal and distroless images may lack time zone data (tzdata), locale files and CA certificates, which leads to wrong local times, encoding issues, or x509: certificate signed by unknown authority…
-
Docker Compose in production: is it appropriate?
It can be for small, single-host deployments (an internal tool, a side project, a single VPS) where you accept a single point of failure, with restart policies, health checks, log rotation, backups…