Install Docker and Run Your First Container

Install Docker, verify it's working, and run a container end to end so you know the setup is solid before building images of your own.

beginner10 minmacos · windows · linuxUpdated August 2026
#docker#containers#installation#devops

Requirements

  • Admin access on your machine
  • A 64-bit OS with virtualization enabled

Choose your platform

0/3 steps · 0%
01

Install Docker Desktop

bash
$ brew install --cask docker

This installs the Docker Desktop application. Open it once from Applications so it can finish setup and start the background engine.

Note

On Apple Silicon, Docker Desktop runs Linux containers via a lightweight virtual machine — this is normal and how Docker works on macOS in general.

02

Verify the CLI is available

bash
$ docker --version

Expected output

Docker version 27.x.x, build xxxxxxx

Note

If this fails, make sure Docker Desktop has finished launching — check for the whale icon in the menu bar.

03

Run your first container

bash
$ docker run hello-world

Expected output

Hello from Docker!
This message shows that your installation appears to be working correctly.

Success

Docker pulled the image, created a container from it, ran it, and printed this message. That's the full lifecycle.

Troubleshooting

The Docker CLI is installed, but the daemon (the background engine that actually runs containers) isn't reachable — usually because it isn't running yet.

On macOS/Windows, make sure Docker Desktop is open and fully started (check the whale icon). On Linux, start the service directly:

bash
$ sudo systemctl start docker
$ sudo systemctl enable docker