Introduction
In this article, I will walk you through the process of installing Docker, a widely-used containerization platform, on various operating systems, including Windows, macOS, and Linux distributions such as Ubuntu and CentOS.
Installing Docker
System Requirements
Before you begin installing Docker, ensure that your system meets the following requirements:
- A 64-bit operating system
- Hardware virtualization support (Intel VT-x or AMD-V)
- At least 4 GB of RAM
- An internet connection to download Docker and its components
Installing Docker on Windows
To install Docker on Windows, follow these steps:
- Download the Docker Desktop installer for Windows from the official Docker website
- Run the installer and follow the on-screen instructions.
- Once the installation is complete, restart your computer.
- After the restart, launch Docker Desktop to verify the installation.
Installing Docker on macOS
To install Docker on macOS, follow these steps:
- Download the Docker Desktop installer for macOS from the official Docker website:
- Open the downloaded installer and drag the Docker icon into the Applications folder.
- Launch Docker Desktop from the Applications folder to complete the installation.
Installing Docker on Linux
The installation process for Docker on Linux depends on the distribution you are using.
Ubuntu
To install Docker on Ubuntu, run the following commands:
# 1. Update package lists:
$ sudo apt-get update
# 2. Install Docker:
$ sudo apt-get install docker.io
# 3. Enable and start the Docker service:
$ sudo systemctl enable --now docker
# 4. Verify the installation:
$ sudo docker --version
CentOS
To install Docker on CentOS, run the following commands:
# 1. Update package lists:
$ sudo yum update
# 2. Install Docker:
$ sudo yum install docker
# 3. Enable and start the Docker service:
$ sudo systemctl enable --now docker
# 4. Verify the installation:
$ sudo docker --version
Post-Installation Steps and Verifying the Installation
After installing Docker on your system, you may want to perform some post-installation tasks to ensure that everything is set up correctly.
- Verify Docker is running:
$ docker info
This command will display information about your Docker installation, such as the number of containers, images, and the version of Docker being used.
- Test your Docker installation by running a simple container:
$ docker run hello-world
This command downloads and runs the hello-world
Docker image, which is a minimal image used to test if Docker is installed and running correctly. If successful, you should see a message indicating that your installation appears to be working correctly.
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
7050e35b49f5: Pull complete
Digest: sha256:4e8q453afed1b4fa1a3300425191dbfca6ce1e66901fd4c01ff015db3b1bq33e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
References