Installing Docker

Install Docker Desktop on Windows and macOS, or Docker Engine on Linux, then verify it works.

Syntaxdocker run hello-world

Before you can build and run containers, you need Docker installed on your machine.

Docker Desktop

On Windows and macOS, install Docker Desktop. It bundles the Docker Engine, the command-line tool, Docker Compose, and a graphical dashboard.

Docker Engine on Linux

On Linux you can install Docker Engine directly using your distribution's package manager, or the convenience script from Docker.

Verify the installation

After installing, open a terminal and run docker run hello-world. Docker downloads a tiny test image and runs it, printing a friendly confirmation message.

Example

Example · bash
# Install Docker Engine on Ubuntu/Debian (convenience script)
curl -fsSL https://get.docker.com | sh

# Verify the install
docker --version
docker run hello-world

When to use it

  • A developer installs Docker Desktop on macOS to build and test containerized apps locally before pushing to a Linux server.
  • A DevOps engineer installs Docker Engine on an Ubuntu server to run production containers without a desktop GUI.
  • A Windows developer enables WSL2 integration in Docker Desktop to get native Linux container performance.

More examples

Install Docker on Ubuntu

Uses Docker's official install script on Ubuntu and grants the current user permission to run Docker without sudo.

Example · bash
sudo apt-get update
sudo apt-get install -y ca-certificates curl
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER

Verify installation

Checks both the Docker Engine and Compose plugin versions, then runs a quick smoke test.

Example · bash
docker --version
docker compose version
docker run --rm hello-world

Configure Docker daemon options

A /etc/docker/daemon.json snippet that sets log rotation and file-descriptor limits for all containers.

Example · json
{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "3" },
  "default-ulimits": { "nofile": { "Hard": 64000, "Name": "nofile", "Soft": 64000 } }
}

Discussion

  • Be the first to comment on this lesson.