From Beginner to Expert: Your Path from Docker to Kubernetes Quiz

Explore the essentials of containerization as you transition from Docker basics to advanced Kubernetes orchestration. This quiz covers installation, core concepts, multi-container management, service scaling, and Kubernetes deployment best practices.

  1. Docker Fundamentals

    Which command is used to run a simple test container that verifies your Docker installation?

    1. docker start test-check
    2. docker compose up test
    3. docker run hello-world
    4. docker create sample-container

    Explanation: The command 'docker run hello-world' downloads and runs a sample container, confirming that Docker was installed successfully. 'docker compose up test' attempts to use Docker Compose, not Docker alone. 'docker create sample-container' only creates—but doesn't run—a container. 'docker start test-check' would only work on an existing, stopped container named 'test-check'.

  2. Containers and Images

    What best describes the relationship between a Docker image and a Docker container?

    1. An image is a template, and a container is a running instance of that image
    2. An image is the running application, while a container is the storage layer
    3. A container builds images using source code
    4. A container manages the orchestration of images for scaling

    Explanation: A Docker image contains the instructions and environment needed to create a container. A container is the live, running instance based on this image. Containers do not build images nor manage orchestration; those functions are handled by other tools. The image is not the running application but the blueprint for it.

  3. Docker Compose Use

    What is the primary purpose of using Docker Compose with a docker-compose.yml file?

    1. To define and manage multi-container applications
    2. To optimize CPU and memory allocation for a single container
    3. To create Docker images from source code
    4. To automatically convert containers to virtual machines

    Explanation: Docker Compose allows users to define and manage multiple related containers using a YAML file. It does not optimize resources for a single container nor convert containers to virtual machines. Image creation is managed by Dockerfiles, not Compose.

  4. Service Scaling in Docker Compose

    Which Docker Compose command would you use to increase the number of running instances of a service named 'web' to three?

    1. docker-compose build --replicas 3 web
    2. docker-compose run web --instances 3
    3. docker-compose up --scale web=3
    4. docker-compose scale-up web=3

    Explanation: The correct command 'docker-compose up --scale web=3' starts three instances of the 'web' service. 'docker-compose build' does not scale services, and the '--replicas' flag is not valid here. 'scale-up' and '--instances' are not valid Docker Compose subcommands or flags.

  5. Kubernetes and Container Orchestration

    What is one major advantage of using Kubernetes over Docker Compose for managing applications?

    1. Kubernetes replaces the need for container registries
    2. Kubernetes allows building images from Dockerfiles
    3. Kubernetes can run only one container at a time
    4. Kubernetes provides advanced orchestration and self-healing for containers

    Explanation: Kubernetes offers features like service discovery, automatic scaling, rolling updates, and self-healing, which go beyond the management capabilities of Docker Compose. It does not directly build images, nor is it limited to a single container. Kubernetes does not replace container registries; it works with them.