Interview Q&A / Docker & Kubernetes

INTERVIEW Q&A · 67 QUESTIONS

Docker & Kubernetes interview questions

Images, containers, Dockerfiles, pods and deployments, from first principles.

  1. What is the difference between liveness, readiness and startup probes in Kubernetes?

    A liveness probe asks "is this container stuck?" and Kubernetes restarts it if the probe keeps failing. A readiness probe asks "can it take traffic right now?" and a failing Pod is removed from Service load balancing without a restart. A startup probe gives slow-starting apps time to boot before the other probes begin.

    AdvancedIn-depth4 min read
  2. How do you run optional services or multiple replicas of a service in Docker Compose?

    Assign a service to a profile so it starts only when requested with --profile. For replicas use docker compose up --scale web=3, which requires the service not to publish a fixed host port.

    AdvancedQuick answer1 min read
  3. How would you back up the data in a Docker volume?

    Run a temporary container that mounts the volume and a host folder, then tar the volume contents into the host folder. Restore by extracting that archive into a volume.

    AdvancedQuick answer1 min read