Docker Flashcards

🐳 Docker Flashcards
🐳 What is Docker?
Docker is a platform for developing, shipping, and running applications inside containers.

📦 What is a Docker Container?
A lightweight, standalone executable package that includes everything needed to run software: code, runtime, system tools, libraries.

🧱 What is a Docker Image?
A read-only template with instructions for creating a Docker container. Images are used to create container instances.

🛠️ What is Dockerfile?
A text document containing instructions to build a Docker image using the `docker build` command.

🗂️ What is Docker Compose?
A tool for defining and managing multi-container Docker applications using a `docker-compose.yml` file.

🔁 What is the difference between CMD and ENTRYPOINT?
Both define default commands, but ENTRYPOINT is not overridden by command-line arguments, unlike CMD.

🔒 What is Docker Hub?
A cloud-based registry where you can find and share container images publicly or privately.

📄 What does the `docker ps` command do?
Lists running containers along with container ID, name, status, and more.

⚡ How do you expose a port in Docker?
Use the `-p` flag like `docker run -p 8080:80` to bind container ports to host ports.

📌 How do you persist data in Docker?
Use volumes by specifying `-v` or `–mount` flags during `docker run` or via Docker Compose.

🔄 What is the lifecycle of a container?
Create → Start → Running → Stop → Delete (optionally restart in between).

🌐 Can Docker run on Windows?
Yes, using Docker Desktop which supports Linux and Windows containers via WSL or Hyper-V.