Docker & Kubernetes interview questions

Images vs containers, writing good Dockerfiles, volumes and networking, Compose, and Kubernetes basics.

Readiness: 0 of 10 nailed

How to use this page: 1. Read a question2. Type your answer3. Check with AI4. Open the model answer5. Timed drill when you’re 70% ready

Docker basics

FoundationConcept

What is the difference between an image and a container? Why use Docker?

JuniorWrite it by hand

Write a good production Dockerfile for a Node app.

JuniorIt’s broken: why?

You restarted the MySQL container and all the data disappeared. Why?

FoundationConcept

What is Docker Compose used for?

JuniorConcept

What are image layers, and how does caching work?

Mid-levelReal-world scenario

How do you secure Docker images and containers?

Networking

Mid-levelIt’s broken: why?

Your app container can’t connect to the database at localhost:5432. Why?

Kubernetes

Mid-levelConcept

Explain Pod, Deployment and Service in Kubernetes.

Mid-levelIt’s broken: why?

A pod is in CrashLoopBackOff. How do you debug it?

kubectl describe pod my-pod        # events, exit codes, OOMKilled?
kubectl logs my-pod --previous     # logs of the crashed attempt
JuniorConcept

ConfigMap vs Secret?

Also prepare