How to Install Docker on Linux, macOS, and Windows

How to Install Docker on Linux, macOS, and Windows

Docker is a platform for developing, shipping, and running applications in containers. Containers are lightweight and efficient, making it easy to package applications and their dependencies into a single, portable unit. In this tutorial, we’ll walk you through the process of installing Docker on Linux, macOS, and Windows.

Prerequisites

Before we get started, ensure you have the following prerequisites:

  1. A computer running Linux, macOS, or Windows.
  2. Administrative or superuser access on your system (for Linux and macOS).
  3. A stable internet connection.

Let’s dive in!

Installing Docker on Linux – Ubuntu

Step 1: Update Your System

Before installing Docker, it’s a good practice to update your system’s package repository and software packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install Docker

  1. Docker provides a convenient script that we can use to run the installation. Download it by running the command below. The –dry-run flag allows us to view the script before running it

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh ./get-docker.sh --dry-run
  2. Once we are ready to run it, enter the following command

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    
  3. Start and enable Docker:

    sudo systemctl start docker
    sudo systemctl enable docker
  4. Verify the installation:

    sudo docker --version
    sudo docker run hello-world
    

This will print the docker version and also run a container that prints the hello world message and exits.

You’re now all set with Docker on Ubuntu!
For other Linux distributions,check out the official docs here https://docs.docker.com/engine/install/

Installing Docker on macOS

Step 1: Install Docker Desktop

  1. Download Docker Desktop for macOS from the Docker website.

  2. Open the downloaded file and drag the Docker icon to your Applications folder.

  3. Launch Docker Desktop from your Applications.

  4. Sign in with your Docker ID or create one if you don’t have it.

  5. Docker will start, and you’ll see the Docker whale icon in your macOS menu bar when it’s ready.

  6. Click on the whale icon to access Docker’s settings and features.

Docker is now installed and ready to use on your macOS system!

Installing Docker on Windows

Step 1: Download Docker Desktop

  1. Download Docker Desktop for Windows from the Docker website.

  2. Run the installer you downloaded.

  3. Follow the installation wizard’s prompts. Choose the default options unless you have specific requirements.

  4. Docker Desktop will install and start automatically.

  5. You’ll see the Docker whale icon in your system tray when it’s ready.

  6. Click on the whale icon to access Docker’s settings and features.

Docker is now up and running on your Windows machine!

Verifying Your Docker Installation

To ensure Docker is installed correctly on any platform, open a terminal or command prompt and run:

docker --version

You should see the installed Docker version displayed, confirming a successful installation.

Congratulations! You’ve successfully installed Docker on Linux, macOS, or Windows. You can now use docker to run containerized applications on your computer!

Leave a Reply