Mastering Docker: A Practical Deployment Guide for Evergreen Applications + Cheatsheet Quiz

Assess your understanding of Docker concepts, setup, image management, and production deployment strategies with this comprehensive quiz. Sharpen your skills in containerization and evergreen application deployment.

  1. Docker Architecture Components

    Which component of the Docker architecture is responsible for creating and managing containers by receiving and executing commands?

    1. Docker Engine (Daemon)
    2. Docker Volume
    3. Docker Compose
    4. Dockerfile

    Explanation: Docker Engine, also called the Daemon, is the core service responsible for managing containers and images by interacting with system resources. Dockerfile is simply a script used to build images, while Docker Volume manages persistent storage. Docker Compose is used for orchestrating multi-container applications, not for directly running containers.

  2. Containers vs. Virtual Machines

    What is a key difference between containers and virtual machines regarding system resources and boot time?

    1. Containers have minimal overhead and boot in seconds, while VMs use more resources and boot slower.
    2. VMs always run faster than containers due to hardware virtualization.
    3. Containers offer lower portability than VMs across environments.
    4. Containers require a separate OS for each instance, while VMs share the host kernel.

    Explanation: Containers are lightweight, sharing the host OS kernel, which results in low overhead and quick startup. VMs, on the other hand, emulate hardware and require more resources and boot time. VMs need separate OS images, not containers. The opposite is true for portability, as containers typically offer higher portability.

  3. Purpose of Dockerfile

    What is the primary purpose of a Dockerfile in the context of Docker application deployment?

    1. To store persistent data generated by applications
    2. To launch and execute running containers
    3. To connect Docker containers to external networks
    4. To define instructions for building a Docker image

    Explanation: A Dockerfile contains a set of instructions that specify how to build a Docker image. It does not launch containers, manage networks, or persist data; those tasks are handled by other Docker features like run commands, network settings, and volumes.

  4. Building and Running Containers

    Which sequence of commands correctly builds a Docker image and runs it as a detached container mapping port 3000?

    1. docker image export myapp:latest > app.tar; docker network start myapp_container
    2. docker pull myapp:latest; docker exec -p 3000:3000 myapp_container
    3. docker-compose up -p 3000:3000 myapp:latest
    4. docker build -t myapp:latest .; docker run -d -p 3000:3000 --name myapp_container myapp:latest

    Explanation: The first command sequence builds an image and then runs a container detached, mapping port 3000 correctly. The other options use incorrect commands: docker-compose requires a YAML file, docker exec is for running commands in existing containers, and docker image export and network start are not for image building or container running.

  5. Ensuring Application Longevity

    Which practice best helps keep Dockerized applications robust and maintainable as technologies evolve?

    1. Sharing containers between different applications
    2. Pinning all image versions to avoid upgrades
    3. Regularly updating base images and dependencies
    4. Disabling health checks to simplify code

    Explanation: Routinely updating images and dependencies reduces security risks and makes sure applications benefit from the latest improvements. Pinning versions can help with stability but may lead to outdated, vulnerable software. Sharing containers between applications can create dependency conflicts. Disabling health checks makes monitoring harder and does not support maintainability.