Back to Blog
Career
Interview Prep
DevOps

Top 20 DevOps Interview Questions (With Answers)

OpsQuiz TeamJuly 28, 20265 min read98 views

Preparing for a DevOps interview usually means brushing up on a wide surface area at once: containers, orchestration, pipelines, cloud, and infrastructure automation all in one conversation. Here are 20 questions that come up repeatedly, with answers concise enough to actually remember.

Docker interview questions

1. What's the difference between an image and a container?

An image is a read-only template; a container is a running (or stopped) instance created from that image. You can spin up many containers from the same image.

2. What's the difference between CMD and ENTRYPOINT?

ENTRYPOINT defines the fixed command that always runs; CMD supplies default arguments that can be overridden at docker run time. Combine both when you want a fixed executable with overridable defaults.

3. What's the difference between a Docker volume and a bind mount?

Volumes are created and managed by Docker itself (stored under Docker's control); bind mounts point directly to a specific path on the host filesystem. Volumes are generally preferred for portability.

4. What is a multi-stage build, and why use one?

A Dockerfile with multiple FROM stages, where later stages copy only the needed artifacts from earlier ones. It keeps final images small by excluding build tools and intermediate files that aren't needed at runtime.

5. How does Docker achieve container isolation?

Through Linux namespaces (isolating process IDs, network, filesystem mounts, etc.) and cgroups (limiting and accounting for resource usage like CPU and memory), not through full OS virtualization.

Kubernetes interview questions

6. What is a Pod, and why not just use containers directly?

The smallest deployable unit in Kubernetes, usually wrapping one container but able to hold several tightly-coupled ones that share network and storage. Kubernetes schedules and manages Pods, not individual containers directly.

7. What does a Deployment do that a bare Pod doesn't?

A Deployment manages a set of replica Pods, automatically replacing failed ones and handling rolling updates. A Pod created directly has no such self-healing or update mechanism.

8. Why do we need Services if Pods already have IP addresses?

Pod IPs change every time a Pod is recreated. A Service provides a stable network identity and load-balances traffic across whichever Pods currently match its label selector.

9. What's the difference between a Deployment and a StatefulSet?

Deployments treat replicas as interchangeable. StatefulSets give each replica a stable identity and its own persistent storage across restarts, needed for things like databases.

10. What's the role of etcd in a Kubernetes cluster?

A distributed key-value store holding the entire cluster's state: every object definition and its current status is stored there, and the control plane reads and writes to it constantly.

CI/CD interview questions

11. What's the difference between Continuous Delivery and Continuous Deployment?

Continuous Delivery means every passing change is automatically packaged and ready to release, but a human triggers the actual release. Continuous Deployment removes that manual gate entirely: passing changes go straight to production.

12. What is a canary deployment?

Releasing a new version to a small percentage of traffic first, monitoring for issues, then gradually increasing the rollout, which limits the impact of a bad release.

13. What's the difference between blue-green and rolling deployments?

Blue-green runs two full identical environments and switches traffic between them instantly (fast rollback, but double the infrastructure during the switch). Rolling deployments replace instances gradually within one environment (no duplicate infrastructure, but a bad release affects a portion of traffic while rolling out).

14. What is a feature flag, and why use one?

A toggle that lets you enable or disable a feature without deploying new code, decoupling code deployment from feature release, so you can ship code dark and turn it on later for specific users.

15. What is GitOps?

Using a Git repository as the single source of truth for infrastructure/application state, with an operator continuously reconciling the live environment to match what's declared in Git, where changes happen via pull requests, not manual deploy commands.

Cloud & Infrastructure as Code interview questions

16. What is the shared responsibility model?

The cloud provider secures the underlying infrastructure (hardware, hypervisor, physical security); the customer is responsible for what they build on top: IAM configuration, data encryption, application security, patching self-managed components.

17. What's the difference between horizontal and vertical scaling?

Horizontal scaling adds more machines/instances to share load; vertical scaling adds more resources (CPU, RAM) to an existing machine. Horizontal scaling is generally preferred for resilience since it avoids a single point of failure.

18. What is Infrastructure as Code, and what problem does it solve?

Managing infrastructure through versioned, reviewable code rather than manual console clicks, giving you repeatability, history, and the ability to recreate environments consistently.

19. What's the difference between Terraform and Ansible?

Terraform provisions infrastructure (creating VMs, networks, managed services) and is declarative and stateful. Ansible configures software on existing machines (installing packages, managing config files) and is agentless, connecting over SSH. Many real setups use both together.

20. What does "idempotent" mean in the context of configuration management, and why does it matter?

Running the same operation multiple times produces the same result as running it once: no duplicated work, no errors on repeat runs. It matters because configuration management tools are frequently re-run against the same servers, and non-idempotent scripts would cause drift or failures over time.

How to actually prepare

Memorizing these answers verbatim helps less than being able to explain why: interviewers routinely follow up with "why would you choose X over Y here?" Understanding the tradeoffs, not just the definitions, is what separates a good answer from a great one.

Want to test yourself under quiz conditions instead of just reading? Try the timed assessments across Docker, Kubernetes, CI/CD, Cloud Platforms, and Infrastructure as Code on OpsQuiz.

    Welcome to OpsQuiz!

    Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.