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.
What is the relationship between a Docker image and a Docker container?
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.
Which command stops a running container named '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.
What is the main benefit of using Docker Compose when working with multi-container applications?
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.
If you want to run three instances of a 'web' service using Docker Compose, which command would you use?
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.
What is the primary advantage of using Kubernetes for containerized application management?
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.