What is Docker?

Docker packages an application and everything it needs into a portable container that runs the same on any machine.

Docker is a tool that lets you package an application together with all of its dependencies into a single, portable unit called a container.

The problem Docker solves

Software often works on one computer but breaks on another because of missing libraries, different versions, or configuration differences. This is the classic "it works on my machine" problem.

A container bundles your code, the runtime, system tools and libraries together, so it runs the same way on your laptop, a teammate's machine, or a production server.

Why developers love Docker

  • Portable — the same container runs anywhere Docker is installed.
  • Lightweight — containers share the host operating system, so they start in seconds.
  • Consistent — development, testing and production use the identical image.
  • Isolated — each container has its own filesystem and processes.

Example

Example · bash
# Check that Docker is installed and see the version
docker --version

# Run your very first container
docker run hello-world

When to use it

  • A startup packages its Node.js API and all its dependencies into a Docker container so every developer runs the exact same environment.
  • A CI pipeline builds a Docker image on every commit, ensuring tests always run against a consistent, isolated runtime.
  • An ops team ships a Python data-processing script as a Docker image so it runs identically on laptops, staging, and production.

More examples

Verify Docker is installed

Confirms the Docker CLI and daemon are installed and reachable.

Example · bash
docker --version
docker info

Pull and run hello-world

Downloads the official hello-world image and starts a container that prints a confirmation message.

Example · bash
docker pull hello-world
docker run hello-world

List running containers

Shows how to inspect which containers are currently running and which have already exited.

Example · bash
# Show only running containers
docker ps

# Show all containers including stopped
docker ps -a

Discussion

  • Be the first to comment on this lesson.