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

Explore foundational container concepts, multi-container setup, and orchestration as you progress from Docker basics to Kubernetes mastery. Learn to manage, scale, and deploy modern applications with confidence.

  1. Understanding Docker Images and Containers

    What is the relationship between a Docker image and a Docker container?

    1. A Docker container is used to build Docker images.
    2. A Docker image is a template, and a container is a running instance of that image.
    3. A Docker image runs directly as an operating system.
    4. A Docker container creates Dockerfiles automatically.

    Explanation: A Docker image serves as a static template with instructions for creating containers. The container is a live, running instance based on that image. Images do not run directly; containers are what execute the code. Containers do not build images, and they do not create Dockerfiles automatically.

  2. Basic Docker Commands Scenario

    Which command stops a running container named 'my-container'?

    1. docker run my-container
    2. docker rm my-container
    3. docker build my-container
    4. docker stop my-container

    Explanation: The 'docker stop my-container' command halts the running container. 'docker build' is for building images, 'docker rm' removes containers but cannot stop a running one, and 'docker run' is used to start containers, not stop them.

  3. Purpose of Docker Compose

    What is the main benefit of using Docker Compose when working with multi-container applications?

    1. It speeds up the internet connection of containers.
    2. It creates Docker images from source code automatically.
    3. It allows defining and managing multiple services using a single YAML file.
    4. It secures containers from malware by default.

    Explanation: Docker Compose enables developers to define multiple services and their configurations in a single YAML file, simplifying setup and management. It does not affect network speed, automate image creation, or secure containers by default; these options are incorrect.

  4. Scaling Services with Docker Compose

    If you want to run three instances of a 'web' service using Docker Compose, which command would you use?

    1. docker ps --replica=3 web
    2. docker-compose up --scale web=3
    3. docker scale web --instances 3
    4. docker-compose start web x3

    Explanation: The correct command is 'docker-compose up --scale web=3', which launches three containers for the 'web' service. The other commands are either syntactically incorrect or not valid Docker Compose commands.

  5. Kubernetes and Container Orchestration

    What is the primary advantage of using Kubernetes for containerized application management?

    1. It automates deployment, scaling, and management of containerized applications.
    2. It is used solely for container image building.
    3. It only works with single-container applications.
    4. It creates Dockerfiles for you automatically.

    Explanation: Kubernetes provides advanced orchestration by automating the deployment, scaling, and ongoing management of containers. It does not create Dockerfiles, is designed for multi-container scenarios, and is not focused on image building.