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:
- A computer running Linux, macOS, or Windows.
- Administrative or superuser access on your system (for Linux and macOS).
- 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
-
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
-
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
-
Start and enable Docker:
sudo systemctl start docker sudo systemctl enable docker
-
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
-
Download Docker Desktop for macOS from the Docker website.
-
Open the downloaded file and drag the Docker icon to your Applications folder.
-
Launch Docker Desktop from your Applications.
-
Sign in with your Docker ID or create one if you don’t have it.
-
Docker will start, and you’ll see the Docker whale icon in your macOS menu bar when it’s ready.
-
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
-
Download Docker Desktop for Windows from the Docker website.
-
Run the installer you downloaded.
-
Follow the installation wizard’s prompts. Choose the default options unless you have specific requirements.
-
Docker Desktop will install and start automatically.
-
You’ll see the Docker whale icon in your system tray when it’s ready.
-
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!