Docker & Containerization Flashcards
What is Docker, and how does it help in application development?
Docker is a platform that allows applications to run in isolated environments called containers. It simplifies the deployment of applications by ensuring they run the same regardless of the environment (dev, staging, production). Containers package the application and its dependencies, ensuring consistency across all stages.
What is the difference between Dockerfile and Docker Compose?
Dockerfile: Used to create an image by specifying the build steps for a single application or service.
Docker Compose: A tool for defining and running multi-container Docker applications. It uses a docker-compose.yml file to define services, networks, and volumes.
How would you troubleshoot a Docker container that’s not starting?
First, check the container logs using docker logs [container_id]. Then inspect the Dockerfile and image for configuration errors, and ensure that dependencies are correctly set up. You can also check container networking with docker inspect.
What’s the difference between Docker and Kubernetes?
Docker is a container runtime for running individual containers, while Kubernetes is a container orchestration platform for managing, scaling, and deploying multiple containers across a cluster of machines.
How do you scale a Docker-based application?
You can scale applications using Docker Swarm or Kubernetes. For Docker Compose, you can scale a service with the docker-compose up –scale command. Kubernetes offers more robust, automated scaling mechanisms.