How to install Docker

With Docker, developers can build, test, and deploy applications faster using containers. By using Containers, software can be deployed consistently, scalably, and repeatably from development to production.

In this answer, you will learn how to install Docker on your computer.

Prerequisites

Docker can be installed on an operating system with:

  • A 64-bit architecture.

  • Good support for virtualization technology.

  • Linux, Windows, and Mac operating systems.

Note: In Windows operating systems, ensure virtualization technology is enabled in the bootloader.

Windows

To install on Windows:

  1. Visit this website to download an executable (.exe) Docker installer for Windows.

  2. Once the installer is downloaded, run it as an administrator and follow the prompts.

  3. A prompt pops up to enable WSL. Make sure this is checked then continue.

  4. Once the installation is completed, restart your computer.

  5. Verify Docker is installed by running the docker command in the Windows command line.

MacOS

To install on MacOS:

  1. Visit this website and select either option for Docker Intel Chip or Apple Silicon to download the .dmg package installer.

  2. Click on the downloaded .dmg file and open the Docker installer.

  3. Docker will prompt you to authorize the Docker Desktop application with your system password. Enter your password and click “OK.”

  4. In the pop-up window, drag and drop the Docker icon into "Applications." Once fully installed, go to "Applications" and click on the Docker desktop icon.

  5. Verify Docker is installed by opening your terminal and run the docker version command.

Linux (Ubuntu)

To install on Linux (Ubuntu distribution):

  1. Update the package index on your Linux (Ubuntu) system by running the following command in a terminal or command prompt:

sudo apt-get update
  1. Run the following command to install the required packages:

sudo apt-get install \\
apt-transport-https \\
ca-certificates \\
curl \\
gnupg-agent \\
software-properties-common
  1. Use the following command to add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Run the following command to add Docker’s stable repository:

sudo add-apt-repository \\
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \\
$(lsb_release -cs) \\
stable"
  1. Lastly, install Docker using the following command:

sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. After installation, start the Docker service by running the following command:

sudo systemctl start docker
  1. Verify Docker CLI is installed by running the following command:

sudo docker run hello-world

Conclusion

You now have all the steps required to install Docker on any operating system of your choice. Follow these installation steps tentatively so you can start building, deploying, and managing your software applications efficiently.