Skip to main content
  1. Articles/

How To Install Docker

·
Ro'i Bandel
Author
Ro’i Bandel
Table of Contents
Docker - This article is part of a series.
Part 2: This Article

This is how I like to install Docker on my workstations.

Choose Environment

Docker runs best on Linux. If using Linux, skip to Install Docker below. If using Windows, read the WSL section first.

Note

I don’t use macOS so cannot advise on installation methods for Docker on macOS. However, Lima, Colima and Rancher Desktop are possible options. See Alternative Docker Installation Methods below.

WSL

On Windows, Docker Engine can be installed inside WSL. This is an alternative to using Docker Desktop (unlike Docker CE, Docker Desktop is not open source).

Install WSL command

You can install everything you need to run WSL with a single command. Open PowerShell in administrator mode by right-clicking and selecting “Run as administrator”, enter the wsl --install command, then restart your machine.

wsl --install
Note

This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux. (This default distribution can be changed).

Install Docker

These commands all need to run in a Linux shell.

1. Install using the official Docker installation script

/bin/sh -c "$(curl -fsSL https://get.docker.com)"
If you are using WSL, you may get a warning about Docker Desktop. Since we do not use Docker Desktop, simply ignore this warning (wait 20 seconds and the installation will resume).

2. After the install completes, complete the Linux post-installation steps for Docker Engine by running the following commands

sudo usermod -aG "docker" "${USER}"
newgrp docker
sudo systemctl enable --now docker.service
sudo systemctl enable --now containerd.service

Optional: Confirm Docker Is Installed

These commands all need to run in a Linux shell.

1. Confirm docker is installed and check versions

docker version
docker --version

2. Confirm the docker buildx and docker compose plugins are also installed (likely already installed alongside docker)

docker buildx version
docker compose version

3. Run a test container

docker run --rm hello-world

Alternative Docker Installation Methods

Note

I do not suggest Docker Desktop as an installation method because it is not open source.

Docker Alternatives for Running OCI Containers

Note

All of these tools can run OCI containers (sometimes referred to as “Docker containers”).

Resources


Featured image by Ian Taylor on Unsplash.

Docker - This article is part of a series.
Part 2: This Article

Related

Git Setup for Windows and WSL

·
Configure Git once for both Windows and WSL: install Git and GCM, reuse your .gitconfig, and enable seamless credential handling across environments.

Docker User Interfaces

·
There are different User Interfaces that help use Docker.

KYAML

·
Today I learned, in Kubernetes v1.34, kubectl will also support a new strict subset of YAML called KYAML.