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.
Which command is used to run a simple test container that verifies your Docker installation?
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'.
What best describes the relationship between a Docker image and a Docker container?
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.
What is the primary purpose of using Docker Compose with a docker-compose.yml file?
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.
Which Docker Compose command would you use to increase the number of running instances of a service named 'web' to three?
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.
What is one major advantage of using Kubernetes over Docker Compose for managing applications?
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.