Installing Docker & your first run

hello-world, and what just happened.

Beginner10 min · lesson 4 of 16
In plain terms
Docker has two halves: a kitchen crew that actually cooks (the daemon, working in the background) and an order pad you write on (the docker command). You never enter the kitchen — you hand tickets to the crew and they do the work.
WHAT docker run DOES
1Look locally
image not found on this machine
2Pull from Docker Hub
download the image
3Create container
instance from the image
4Run its program
prints the message
5Program exits
container stops
Pull then create then run is the same sequence behind every docker run; hello-world's program prints once and exits, so the container stops.

How you install Docker depends on your machine. On Linux you install Docker Engine directly — it runs containers natively because the kernel is right there. On macOS and Windows you install Docker Desktop, which runs a small Linux VM under the hood (containers need a Linux kernel) and gives you the same command-line experience. Either way you end up with two pieces: a background service called the daemon, and the docker command-line client you type into.

terminal
$ docker version # confirms the client AND the daemon are talking
Client: version 27.1.1
Server: Engine 27.1.1 # if Server is missing, the daemon is not running
$ docker info | head -4 # a summary of the running engine
Containers: 3
Images: 12
Server Version: 27.1.1

Your first container

The traditional first run is hello-world, and it is worth reading what it actually does. Docker looks for the image locally, does not find it, pulls it from Docker Hub, creates a container from it, runs its one program (which prints a message), and the program exits — so the container immediately stops. That whole sequence, pull then create then run, is what every docker run does.

terminal
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world ... done
Hello from Docker!
This message shows that your installation appears to be working correctly.

Client and daemon

The docker command is only a client. It sends your instructions to the Docker daemon over a local socket, and the daemon does the real work — pulling images, creating containers, managing storage and networking. You rarely think about this split at first, but it explains later behaviour: for example, the build context is sent from the client to the daemon, and securing that daemon socket becomes a real concern in production.

The docker group is root-equivalent
On Linux, anyone who can talk to the Docker daemon can start a container that mounts the whole host filesystem as root — so adding a user to the docker group effectively grants them root. It is convenient on a dev laptop; on a shared or production host it is a decision to make deliberately, not a default to copy from a tutorial.