Docker can be installed on Linux, macOS, or Windows 10. Docker Engine can be installed on a variety of Linux platforms through Docker Desktop Docker, macOS Docker installation and Windows 10 Docker installation in the form of static binary installation. More Docker installation guide can refer to the official documentation [Docker official website], the following is a brief summary of the installation process.

Requirements and installation instructions can be found on the Official Docker Documentation Center help page.

1. Install Docker on Linux

Docker is usually available in official Linux repositories, although these repositories often offer older versions. 64-bit versions of the latest popular Linux distributions support the latest versions:

  • Ubuntu (and derivatives such as Mint)
  • CentOS
  • Debian
  • Fedora

Static binaries also work with other distributions, although a search for “Docker Installation” may provide a simple explanation.

It’s best to follow the latest documentation, but Docker for Ubuntu usually installs the following commands:

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install 
  apt-transport-https 
  ca-certificates 
  curl 
  gnupg-agent 
  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | 
  sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository 
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
  $(lsb_release -cs) 
  stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Copy the code

To run Docker as a non-root user (without), create yourself and add it to the group: sudo Docker

sudo groupadd docker
sudo usermod -aG docker $USER
Copy the code

Now restart to apply all the changes.

Install Docker Compose on Linux

Docker Compose is installed separately using the following command:

sudo curl 
  -L "https://github.com/docker/compose/releases/download// 
      docker-compose-$(uname -s)-$(uname -m)" 
  -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Copy the code

Here is the latest version number, such as. 1.27.4

2. Install Docker on macOS

Docker desktop for Mac OS Sierra 10.13 and later can be downloaded from Docker Hub. The package includes Docker server, CLI, Docker Compose, Docker Swarm, and Kubernetes.

There are two versions: stable and Edge with experimental features. The stable version is the most suitable for most developers.

Double-click to open the installer, and then drag the Docker icon into the Applications folder. Double-click docker.app in that folder to launch Docker. Docker.dmg

When done, the whale icon in the status bar indicates that the Docker is running and commands can be entered in the terminal.

3. Test whether Docker is installed correctly

Check that Docker has been successfully installed by typing the following command in the terminal:

docker version
Copy the code

Information similar to the following is displayed:

Enter the following command to make sure Docker Compose is up and running:

docker-compose version
Copy the code

The running results are as follows:

Docker-compose version 1.25.5, build 8a1C60f6 Docker-py version: 4.1.0 CPython version: 3.7.5 OpenSSL version: OpenSSL 1.1.1 F 31 Mar 2020Copy the code