Interview Q&A / Docker & Kubernetes

INTERVIEW Q&A · 67 QUESTIONS

Docker & Kubernetes interview questions

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

  1. Does depends_on in Docker Compose wait until the database is ready?

    By default no. depends_on only controls start order, not readiness. To wait for a healthy service, add a healthcheck and use depends_on with condition: service_healthy.

    IntermediateQuick answer1 min read
  2. What does the HEALTHCHECK instruction do in a Dockerfile?

    HEALTHCHECK tells Docker how to test that the app inside is actually working. Docker runs the command at intervals and marks the container healthy or unhealthy, visible in docker ps. It does not restart it by itself.

    IntermediateQuick answer1 min read