Docker Installation
Install Docker on Linux, Windows, and macOS as a practical reference for later development environment guides.
This article is written as a reference for later development environment guides.
Operating System
CentOS
Install the required packages.
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
Add the stable repository.
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Install Docker.
$ sudo yum install docker-ce docker-ce-cli containerd.io
Start Docker.
$ sudo systemctl start docker
Run the Hello World container.
$ sudo docker run hello-world
Debian
$ sudo apt-get update
Install the required packages.
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
Add Docker's official GPG key.
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Add the stable repository.
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
$ sudo apt-get update
Install Docker.
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Run the Hello World container.
$ sudo docker run hello-world
Fedora
Install the required packages.
$ sudo dnf -y install dnf-plugins-core
Add the stable repository.
$ sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
Install Docker.
$ sudo dnf install docker-ce docker-ce-cli containerd.io
Start Docker.
$ sudo systemctl start docker
Run the Hello World container.
$ sudo docker run hello-world
Ubuntu
$ sudo apt-get update
Install the required packages.
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
Add Docker's official GPG key.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the stable repository.
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
$ sudo apt-get update
Install Docker.
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Run the Hello World container.
$ sudo docker run hello-world
Docker should now be working.
Windows
Docker Desktop on Windows currently supports Windows 10 64-bit Enterprise, Pro, or Education 22H2 (build 19045) and Windows 11 64-bit Enterprise, Pro, or Education 23H2 (build 22631) or later.
For the WSL 2 backend, enable WSL 2 and hardware virtualization. You also need WSL 2.1.5 or later, a 64-bit processor with SLAT, and at least 8 GB of RAM. If you use the Hyper-V backend, enable the Hyper-V and Containers Windows features.
After downloading and installing Docker Desktop for Windows, you should see the Docker icon in the bottom-right corner.
Run the Hello World container.
docker run hello-world
macOS
Docker Desktop on Mac supports the current and two previous major macOS releases. At least 4 GB of RAM is required.
After downloading and installing Docker Desktop for Mac, you should see the Docker icon in the menu bar.
Run the Hello World container.
docker run hello-world