Install Docker and Run Hello World

How to install the Docker engine and run the official hello-world image to verify everything works.

Install the engine

Installation steps depend on your operating system.

Windows and macOS — Download and install Docker Desktop from the official Docker website (https://www.docker.com/products/docker-desktop). Docker Desktop includes the engine, CLI tools, and a background service.

Linux — Use your distribution's package manager or the official convenience script. For Ubuntu or Debian:

sudo apt-get update
sudo apt-get install docker.io
sudo systemctl enable --now docker

After installation, run docker version to confirm both the client and daemon are reachable.

Run the hello-world image

The official hello-world image is the smallest possible test. It does nothing useful but confirms that your installation can pull images from Docker Hub and start containers.

docker run hello-world

Docker checks whether the image is already on your machine. If not, it pulls it from Docker Hub automatically. Then it starts a container, which prints a confirmation message and exits.

When you run hello-world and see "Hello from Docker!", the full stack is working: the CLI, the daemon, image pulling, and container execution.

What you learn from it

This single command demonstrates the three core Docker operations: pull, create, and run. All more complex workflows are built on these same steps.

The container exits immediately because hello-world has no long-running process. For web servers and databases, the container keeps running until you stop it.