Skip to content
Laviyx Learn

Try

Docker and Kubernetes course menu

How to Install Docker on Windows, Mac and Linux

Install Docker Desktop on Windows and macOS or Docker Engine on Ubuntu, run Docker without sudo, check the installation, and fix common setup problems.

Beginner3 min readUpdated
On this page

Windows#

  1. Install WSL if you do not have it.
  2. Download Docker Desktop and install it, leaving the Use WSL 2 option on.
  3. Start Docker Desktop, and wait for it to say that the engine is running.

Run the commands in this course from Ubuntu (WSL), PowerShell or Git Bash.

macOS#

Download Docker Desktop for your chip (Apple silicon or Intel), drag it to Applications, and start it.

Linux#

On a server, install Docker Engine. On Ubuntu, Docker's convenience script is the quickest way for a test machine:

Terminal
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Docker's install guide shows the manual steps, which are better for production.

Run Docker without sudo#

On Linux, add your user to the docker group, then log out and in again:

Terminal
sudo usermod -aG docker $USER

Check the installation#

Terminal
docker --version
docker compose version
Output
Docker version 28.0.4, build b8034c0
Docker Compose version v2.38.2

Your versions may be newer. Everything in this course should work with any recent version.

Now run a test container:

Terminal
docker run --rm hello-world | head -n 4
Output
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
Digest: sha256:c567b231f65614688711a75f31518a064258a51d442117a3e771a3a8fdba78ef
Status: Downloaded newer image for hello-world:latest

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

If you see "Hello from Docker!", everything works. You will learn what happened in the next lesson.

How Docker works#

docker is a client. It sends your commands to the Docker daemon, a background service that does the work. This command shows both:

Terminal
docker info --format 'Server version {{.ServerVersion}}, storage driver {{.Driver}}'
Output
Server version 28.0.4, storage driver overlay2

Common errors#

Key takeaway#

Next: Running Your First Container.

Finished this lesson?

Some links are affiliate links. If you buy through them, Laviyx Learn may earn a commission at no extra cost to you. As an Amazon Associate, we earn from qualifying purchases.