Simplifying Docker Installation on Linux

Simplifying Docker Installation on Linux

In the boundless ocean of software development, containerization has emerged as the trusty vessel for developers, ensuring smooth sailing even in turbulent waters of system discrepancies and compatibility woes. Among the fleet of containerization tools, Docker shines bright as the beacon of reliability and ease. Docker facilitates wrapping up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment. This article unfurls the sails to guide you through the calmest route to installing Docker on your Linux machine, ensuring a swift, hassle-free voyage into the realms of containerization.

Preparing for Installation

System Requirements

Before embarking on this voyage, ensure that your vessel – in this case, your Linux machine – is sea-worthy and ready to harness the winds of Docker.

  1. Check Your Linux Distribution and Version: Docker supports Ubuntu, Debian, Fedora, CentOS, and many more. Ensure you're running a supported version of your Linux distribution.

  2. Hardware Prerequisites: Although Docker is quite lightweight, ensuring your system meets the minimum hardware requirements is prudent. A system with a 64-bit architecture, and at least 2GB RAM is recommended.

Updating System Packages

Embarking on the high seas with an outdated map is a recipe for disaster. Likewise, before installing Docker, updating your system's package database ensures a smoother sail.

  1. Run the following command to update the list of available packages:

sudo apt-get update

Installation Method: Using the Repository

Sailing through the calm waters is always advisable. Installing Docker from the official repository is akin to such a peaceful voyage.

Setting Up the Docker Repository
  1. Update the apt package index:

sudo apt-get update

  1. Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

  1. Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

  1. Set up the stable repository:

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Installing Docker Engine
  1. Update the apt package index again (if not already done):

sudo apt-get update

  1. Install the latest version of Docker Engine and containerd:

sudo apt-get install docker-ce docker-ce-cli containerd.io

Verifying the Installation
  1. Run the Docker hello-world image:

sudo docker run hello-world

  1. Check Docker version and ensure the daemon is running:

docker --version

Installation Method: Using Convenience Script (Alternative)

For sailors in a hurry or those favoring a less hands-on approach, Docker provides a convenience script for installation.

  1. Download and execute the script:

curl -fsSL https://get.docker.com | sh

  1. Verify the Installation (as described above).

Basic Docker Commands

Now with Docker installed, understanding some basic commands will help you navigate through the basics of Docker usage.

  1. Starting, stopping, and restarting Docker daemon:

sudo systemctl start docker sudo systemctl stop docker sudo systemctl restart docker

  1. Running Docker containers:

docker run [IMAGE]

  1. Fetching Docker images from Docker Hub:

docker pull [IMAGE]

Conclusion

You've now successfully installed Docker on your Linux machine and taken the first step into a larger world of containerization. With basic commands at your disposal, the vast expanse of Docker's functionality awaits your exploration. The official Docker documentation is an excellent compass for those seeking to delve deeper into advanced configurations and optimizations. As you set sail on the silicon seas with Docker as your vessel, may smooth sailing and calm waters be ever in your favor.

George Whittaker is the editor of Linux Journal, and also a regular contributor. George has been writing about technology for two decades, and has been a Linux user for over 15 years. In his free time he enjoys programming, reading, and gaming.

Load Disqus comments