avatarAman Ranjan Verma

Summary

This article provides a comprehensive guide for installing Docker and Docker Compose on Linux virtual machines, aimed at both system administrators and developers.

Abstract

The website offers a step-by-step tutorial designed to simplify the process of installing Docker and Docker Compose on Linux VMs. It begins with an introduction to the importance of containerization and then proceeds to detail the necessary prerequisites for installation. The guide includes commands for updating the package index, installing required packages, and setting up Docker's GPG key. It then outlines the installation of Docker components, including the Docker engine and containerd runtime, and ensures Docker starts automatically upon system boot. The article also covers the installation of Docker Compose, emphasizing its role in managing multi-container applications. The conclusion encourages readers to apply their new skills in containerization to enhance deployment processes and stay current with industry trends.

Opinions

  • The guide is presented as user-friendly, suggesting that it is suitable for users who may be new to containerization.
  • The author assumes the reader has basic access to a Linux VM, either through SSH or other means, and is ready to execute commands.
  • The use of Docker Compose is highly recommended for managing complex applications, indicating its importance in the containerization ecosystem.
  • The tutorial is designed to build confidence in users, empowering them to enter the containerization world with a solid foundation.
  • The inclusion of a conclusion implies a sense of accomplishment and encourages continuous learning in the field of containerization.

Step-by-Step Guide to Installing Docker and Docker Compose on Linux VMs

Simplify Your Containerization Journey with This User-Friendly Tutorial

Welcome to our concise guide to installing Docker and Docker Compose on Linux virtual machines. This step-by-step manual demystifies the installation procedure and enables you to confidently enter the containerization world, a crucial skill for both system administrators and developers.

ARV Original Creation

This blog assumes that you have just launched a VM and are at least connected to it through your local terminal via SSH. However, there are other ways to connect to your VM; the point is that you should be able to run commands on your VM.

Table of contents

· Install Prerequisites · Install Docker · Install Docker Compose · Conclusion

Install Prerequisites

Docker installation is a prerequisite for building and deploying a Docker image, and for Docker to be installed, there are some additional prerequisites. 😃

# Updates the package index on your system
sudo apt update

# Installs the necessary packages for adding a new repository and managing secure connections:
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y

# Downloads the Docker GPG key and saves it to a keyring file:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# Adds the Docker repository to your system's package sources:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Updates the package index on your system
sudo apt update

Install Docker

Now that we are ready to install Docker, let’s install the following Docker components:

  • docker-ce: Docker Community Edition, the core Docker engine that manages containers, images, and other Docker objects.
  • docker-ce-cli: Docker Community Edition Command Line Interface, which provides the docker command for interacting with the Docker engine.
  • containerd.io: containerd is a container runtime used by Docker to manage container execution and supervision.
sudo apt install docker-ce docker-ce-cli containerd.io -y

# Enables the Docker service to start automatically at system boot. 
# It creates a symlink in the appropriate systemd directory, ensuring that the Docker service is started when the system boots up.
sudo systemctl enable docker

# Starts the Docker service immediately. 
# After running this command, the Docker engine will be running, and you can use Docker commands to manage containers and images.
sudo systemctl start docker

# This command displays the installed Docker version. Verifies that the docker installation is comeple.
docker --version

Install Docker Compose

Docker Compose makes it easier to orchestrate and manage multi-container applications, while Docker is in charge of creating and managing individual containers. Together, they effectively manage application dependencies, deploy services, and manage their configurations to improve the containerization experience. Use the commands listed below to install Docker Compose.

# This command downloads the Docker Compose binary on the system.
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# This command makes the downloaded Docker Compose binary executable.
sudo chmod +x /usr/local/bin/docker-compose

# This command displays the installed Docker Compose version.
docker-compose --version

Conclusion

With the help of our detailed instructions, you can install Docker and Docker Compose on Linux virtual machines. Utilize your newly acquired skills to streamline deployments as you continue to learn about containerization so that you can stay on the cutting edge of this fast-paced industry. Happy containerizing!

Docker
Docker Compose
Containers
Containerization
DevOps
Recommended from ReadMedium