Docker Tutorial — Verify Installation

less than 1 minute read

Let’s verify Docker is installed correctly by running your first containers.


The Classic: hello-world

$ docker run hello-world

# Expected output:
# Unable to find image 'hello-world:latest' locally
# latest: Pulling from library/hello-world
# ...
# Hello from Docker!
# This message shows that your installation appears to be working correctly.

What Just Happened?

  1. Docker CLI sent a run command to the daemon
  2. Daemon looked for hello-world:latest locally — not found
  3. Daemon pulled the image from Docker Hub
  4. Daemon created a container from the image
  5. Container ran, printed the message, and exited

Run an Interactive Container

$ docker run -it ubuntu bash

# You're now INSIDE a container
root@a1b2c3d4e5f6:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"

root@a1b2c3d4e5f6:/# hostname
a1b2c3d4e5f6

root@a1b2c3d4e5f6:/# exit

The -it flags mean:

  • -i → interactive (keep STDIN open)
  • -t → allocate a terminal (TTY)

Verify Docker Compose

$ docker compose version
Docker Compose version v2.24.5

If you see a version number, Docker Compose is ready.


Quick Reference

Verify Docker:    docker run hello-world
Interactive run:  docker run -it ubuntu bash
Verify Compose:   docker compose version
Check version:    docker version
Check info:       docker info

← Docker CLI Basics Practice Exercises →

Updated: