Skip to content
Live on Product Hunt

We just launched BrainUp on Product Hunt. Thanks for coming over!

BrainUp
  • Templates
  • Resume Guides
  • Blog
  • Pricing
  • Contact
Log inBuild Resume
  • Templates
  • Resume Guides
  • Blog
  • Pricing
  • Contact
  • Log in
Build My Resume — Free
BrainUp

Build your resume. Then build your advantage. The career productivity toolkit for your whole job search.

Products

  • Free Resume Builder
  • Cover Letter Builder
  • LinkedIn Optimizer (Premium)
  • AI Interview Prep (Premium)
  • Job Tracker (Premium)

Resources

  • Resume Templates
  • Resume Guides
  • Career Blog

Company

  • Pricing
  • Contact us

Legal

  • Terms
  • Privacy
  • Cookies

© 2026 BrainUp. All rights reserved. ·

BrainUp is a career productivity tool, not a recruitment agency. We help you prepare — we don't guarantee interviews, job offers or ATS outcomes.

BrainUp

  1. Home
  2. Docker Interview Questions

Docker interview prep

Docker Interview Questions: Images, Layers and Real Debugging

Docker interviews test images vs containers, Dockerfile instructions and layer caching, multi-stage builds, volumes and networking, Docker Compose, image security, and how you debug a container that won't start.

Practise with AI Interview PrepSee DevOps engineer resume
  • 15 questions answered
  • Dockerfile tips
  • Compose basics
  • Fresher to mid-level

Sample answers

Explain layers and you explain most of Docker.

Build speed, image size and security all come back to how layers work.

Model answers for 4 Docker questions

Typical round: concepts, Dockerfile review, troubleshooting

Q: How do you make a Docker build faster? A: Order instructions from least to most frequently changing so cached layers are reused: copy dependency files and install packages before copying source code. Use a .dockerignore to keep the build context small.

Q: What is a multi-stage build? A: A Dockerfile with several FROM stages, where you compile in a full build image and copy only the output into a slim runtime image. It shrinks image size and removes build tools from production.

Q: CMD vs ENTRYPOINT? A: ENTRYPOINT sets the executable that always runs; CMD sets default arguments that can be overridden at docker run. A common pattern is ENTRYPOINT for the binary and CMD for default flags.

Q: A container exits right after starting. How do you debug it? A: Check docker ps -a for the exit code, read docker logs, inspect the command and environment with docker inspect, and start an interactive shell from the same image to run the command manually.

What interviewers check

Built for scanners, humans and hiring intent.

  • Dockerfile skills

    Layer ordering, caching, multi-stage builds and small base images show practical experience.

  • Storage and networking

    Volumes, bind mounts, bridge networks and port mapping come up in every round.

  • Image security

    Non-root users, minimal bases, pinned versions and vulnerability scanning are expected.

  • Debugging

    Logs, inspect, exec and exit codes show you can fix containers, not just run them.

Examples

Copy the structure, not the wording.

These examples show shape and specificity. Add your own facts, metrics, tools and outcomes.

Concepts

  • Image vs container?
  • Docker vs virtual machine?
  • What is a Docker registry?
  • What is a layer?
  • What is the build context?

Dockerfile and Compose

  • COPY vs ADD?
  • RUN vs CMD vs ENTRYPOINT?
  • Volume vs bind mount?
  • What does Docker Compose do?
  • How do you pass environment variables?

Troubleshooting

  • The image is 1.2GB. How do you shrink it?
  • A container can't reach the database. What do you check?
  • Data disappears after restart. Why?
  • Builds are slow in CI. What do you change?
  • A scan finds critical vulnerabilities. What next?

Actionable tips

Small edits that lift response rates.

Run through these before every application.

  1. 1Know your Dockerfile coldBe able to write a production Dockerfile for your stack from memory.
  2. 2Explain size winsMoving to a slim or distroless base with multi-stage builds is a good concrete story.
  3. 3Mention securityRunning as non-root and scanning images signals production readiness.
  4. 4Connect to KubernetesMany roles test Docker and Kubernetes together; know how images reach a cluster.
  5. 5Rehearse aloudBrainUp AI Interview Prep runs DevOps mock interviews with feedback.

FAQ

Common questions, direct answers.

What is Docker?

Docker is a platform for packaging applications and their dependencies into containers that run consistently across machines.

What is the difference between an image and a container?

An image is a read-only template built from a Dockerfile. A container is a running, isolated instance of an image with its own writable layer.

How is Docker different from a virtual machine?

Containers share the host OS kernel and isolate processes, so they start fast and are lightweight. VMs run a full guest OS on a hypervisor and are heavier.

What is a Dockerfile?

A text file of instructions such as FROM, COPY, RUN and CMD that Docker follows to build an image layer by layer.

What are Docker layers?

Each instruction creates a cached, read-only layer. Unchanged layers are reused in later builds, which is why instruction order affects build speed.

What is a multi-stage build?

A Dockerfile with multiple FROM stages that copies only needed artefacts into the final image, keeping it small and free of build tools.

What is the difference between COPY and ADD?

Both copy files into the image. ADD can also fetch URLs and extract local tar archives. Prefer COPY unless you need those extras.

What is the difference between CMD and ENTRYPOINT?

ENTRYPOINT defines the main executable. CMD provides default arguments or a default command that can be overridden at runtime.

What are Docker volumes?

Managed storage outside the container's writable layer that persists data across container restarts and can be shared between containers.

What is Docker Compose?

A tool to define and run multi-container apps with a YAML file listing services, networks and volumes, started with docker compose up.

What Docker networks exist?

Common drivers are bridge (default for single host), host (shares host network), none, and overlay (multi-host, used with Swarm).

How do you reduce Docker image size?

Use slim or distroless base images, multi-stage builds, combine and clean up RUN steps, and exclude files with .dockerignore.

How do you secure Docker containers?

Run as a non-root user, use minimal and pinned base images, scan for vulnerabilities, avoid secrets in images, and limit capabilities and resources.

How do you see logs of a container?

Use docker logs with the container name or ID, adding -f to follow output in real time.

How should I prepare for a Docker interview?

Containerise a real app with a multi-stage Dockerfile and Compose, practise troubleshooting commands, and learn how images are scanned and deployed.

Related guides

Keep improving your application.

  • DevOps Interview QuestionsThe wider DevOps round around Docker.See DevOps questions →
  • Kubernetes Interview QuestionsWhere your containers usually run.See Kubernetes questions →
  • DevOps Engineer ResumePresent container and pipeline work.View DevOps resume →

Practise Docker interview answers

BrainUp AI Interview Prep runs DevOps mock interviews tailored to your level.

Start interview practiceBrowse templates

The resume builder and PDF downloads are free. AI tools are part of BrainUp Premium.