What is a Docker Container?

A container is an isolated environment that runs on top of the host operating system using Docker’s container engine. It shares the OS kernel but runs independently — lightweight and faster than VMs.

How It Works

  • Start with a Docker image (blueprint).
  • When Run Docker image → Docker creates a container.
  • The container runs the app in isolation but can still communicate with the outside world if configured.

Key Features

  • Isolation : Each container runs in its own environment.
  • Portability : Runs the same way on any machine with Docker.
  • Lightweight : Shares OS kernel — faster than VMs.
  • Reproducible : Same image = same behavior everywhere.
  • Disposable : Easy to start/stop/remove

Common Commands

Command Function
docker create Create a container but don’t start it.
docker run Create & start container
docker start Start existing one
docker stop Stop running container
docker rm Remove a stopped container
docker logs View container logs.
docker exec -it bash Access the container shell.

Docker Desktop

  • All-in-one app for Windows/macOS to run Docker.
  • Provides Docker Engine, CLI, GUI dashboard, and optional Kubernetes.
  • Uses a lightweight Linux VM to run containers on non-Linux OS.
  • Easy setup, manage images/containers, integrates with VS Code/WSL2.

Docker Desktop = Docker + GUI + Linux VM for easy container management.

Architecture

 Docker Engine for Linux

 Docker Engine for other OS