Docker interview questions
100 Cloud & DevOps practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise Docker questionsBeginner
- "Port is already allocated" error
- App in container cannot be reached from the browser
- Basic container lifecycle commands
- Choosing a base image
- CMD vs ENTRYPOINT
- Code changes do not show up in the container
- Common Dockerfile instructions
- Configuring containers with environment variables
- Container exits immediately after starting
- Container keeps restarting
- Container registries
- Container restart policies
- COPY vs ADD
- Database data disappears when the container is recreated
- Docker Compose
- Docker containers vs virtual machines
- Docker eating disk space on a developer laptop
- Docker network types
- Getting a shell inside a running container
- Image is over 2 GB
- Image layers and build caching
- Image tags and digests
- Images vs containers
- Passing a secret to a container safely in development
- Permission denied when writing to a mounted folder
- Publishing container ports
- Running supporting services for local development
- The .dockerignore file
- Two containers cannot talk to each other
- Viewing container logs
- Volumes vs bind mounts
- What a Dockerfile is
- What Docker is and why teams use containers
- Why containers should be stateless and immutable
Intermediate
- "exec format error" when running an image on servers
- A secret was found inside an image layer
- Application killed abruptly on every deploy
- BuildKit features
- Builds are slow because the build context is huge
- Choosing between Alpine and Debian slim for a Python service
- Container cannot resolve external hostnames
- Container health checks
- Container killed with exit code 137
- Containerising an app that writes logs to files
- Controlling startup order in Docker Compose
- Debugging a container that has no shell
- Distroless and minimal images
- Docker logging drivers
- Hitting Docker Hub pull rate limits
- How Docker uses namespaces and cgroups
- Java service ignores the container memory limit
- Multi-architecture images
- Multi-stage builds
- OCI, containerd and runc
- PID 1 and graceful shutdown in containers
- Podman and other Docker alternatives
- Running a Docker Compose app on a single production server
- Running containers as a non-root user
- Scanning container images for vulnerabilities
- Security review flags containers running as root
- Service discovery on user-defined networks
- Setting CPU and memory limits on containers
- Slow file operations with bind mounts on macOS
- Web service starts before the database is ready
- Writing cache-friendly Dockerfiles
- Wrong time zone and character encoding in a container
- Zombie processes accumulating in a container
Experienced
- "Too many open files" errors inside a container
- A container escape vulnerability is announced
- App fails with a read-only root filesystem
- Base image updates keep breaking builds
- Building images in CI without privileged Docker-in-Docker
- Container memory grows until killed, but the heap looks fine
- Container registry outage blocks deployments and scaling
- Container slows down as it writes to its own filesystem
- Containerising a stateful legacy monolith
- Defining container image standards for the whole organisation
- Enforcing hardened container settings across 200 services
- How container memory is accounted
- How Docker networking works under the hood
- How strong container isolation really is
- Hundreds of vulnerabilities reported in your images
- Inside an OCI image: manifests, layers and indexes
- Intermittent packet loss between containers on busy hosts
- Keeping base images patched across an organisation
- Kubernetes no longer uses Docker Engine as its runtime
- Linux capabilities and seccomp in containers
- Multi-architecture builds are painfully slow in CI
- Overlay filesystems and storage drivers
- Profiling a CPU-hungry container in production
- Reproducible container image builds
- Rootless containers and user namespaces
- Running GPU workloads in containers
- Running untrusted user code in containers
- Sandboxed container runtimes
- SBOMs for container images
- Shrinking a 1.2 GB Node.js image
- Slow container starts because of image pulls during scale-out
- Teams pulling unvetted images from public registries
- The risk of mounting the Docker socket