Open In App

Install Docker Engine On CentOS Using AWS EC2 Instance

Last Updated : 26 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The Docker Engine facilitates efficient containerization and helps optimize the deployment and management processes. CentOS and Redhat are enterprise-based Linux distributions. Working on this using containerization technology enhances productivity by containerizing your applications and managing them separately. In this article, we will go on to discuss step-by-step how to setup the Debian operating system on top of AWS and step-by-step guidance for the installation of Docker on this. This article gives you a clear understanding and helps in set up and work with a Docker container in a Debian environment.

What Is Centos?

CentOS stands for Community Enterprise Operating System, is an open-source, freely available Linux distribution that is known for its stability and reliability. It is derived and developed from the upstream source code of the popular enterprise operating system, Red Hat Enterprise Linux (RHEL). CentOS comes with a strong community-supporting platform that will be ideal for server environments. It offers a secured and scalable base for various applications. It comes with long-term support and compatibility, and it is widely adopted for hosting servers, both in enterprise and community settings.

What is the Docker Engine?

Docker Engine is a powerful containerization platform that helps simplify the deployment and management of applications by encapsulating them into lightweight, portable containers. These Docker platform containers include the application code, runtime, libraries, and system tools, ensuring consistent performance across different environments. Docker Engine will provide efficient isolation, scalability, and portability of applications, making it a popular choice for developers and system administrators.

Step-by-Step Guide: Install Docker Engine on CentOS

Firstly, we here go on implementing the Centos Platform setup, and then we move on to the installation of Docker on this Centos OS platform.

Step 1: Login to the Amazon Console

  • Firstly, navigate to the AWS account login console.
  • Log in with your AWS account credentials.

AWS-login-in

Step 2: Navigate To EC2 Dashboard

  • After login in with your credentials, navigate to EC2 dashboard from the console home.
  • Click on the “Launch Instances” to create an instance.

EC2-Dashboard

Step 3: Choose Centos AMI Image

  • Provide the Name to the creating instance.
  • In selecting AMI click on “browse more AMI”.
  • specify the number of the instances section with 1.

Choosing-AMI

  • Then search for centos based AMIs in the search box.
  • Select the first coming centos AMI images as shown in the below screenshot.

Note: Here I am selecting centos with lastest version that is available, you can also choose other AMI Centos Images also.

Searching-for-Centos-AMI

  • After selecting you will be directed as shown in the below screenshot. select for “subcribing on Instance Launch”.

Subscribing-on-Instance-launch

  • After choosing the centos latest versioned AMI, select the instance type t2.micro.
  • Select the existing ssh key if available or create new ssh key pair.
  • Now click on Edit option beside the network security groups.

Configuring-Instance-and-key

  • Configure the Network security groups, with enabling all the traffic to not face any issues from the AWS network end.
  • Configure the settings with All traffic , all ports and protocols and accessing any inbound traffic from any sourceIP as shown in the below screenshot.

Network-configuration

Step 4: Connect To The Instance

  • Wait for the status of the created instance come to running state from the pending state.
  • After once, the instance came to the running state, select the instance and connect to it.

8-Connecting-To-Running-Instance

Step 5: Go For SSH Connection With Local System

  • After connecting go to the SSH section.
  • From that ssh section copy the ssh command.
  • Go to the local system command line, redirect to the ssh key containing directory.
  • Run this copied ssh command their and connect to the CentOs instance remoted from the local system.

Updating-The-Yum-repo

Step 6: Update The System Software

  • After once connected to the Instance update the system with the following command:
sudo yum update -y

  • The following screenshot shows practical about updating the system with the above command.

Updating-The-Yum-repo

Step 7: Install Docker Dependencies

  • Install the docker dependencies such as yum-utils, device-mapper-persistent-data and lvm2 software drivers with the following command:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

  • The following screenshots show the installation of docker dependencies practically.

11-Installing-Docker-dependencies

Step 8: Add Docker Repository

  • Now add docker repository to this debain Operating system with running the following command:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  • The following screenshot show clearly on executing the above command it results adding of registry kind of message.

Adding-Docker-gfg-key

Step 9: Install Docker Engine

  • Install the Docker Engine using yum packager with following command:
sudo yum install -y docker-ce docker-ce-cli containerd.io

  • The following screenshot illustrates the installation of docker-ce, docker-ce-cli and containerd.io softwares.

Installing-The-Docker

Step 10: Start and Enable Docker

  • Start the Docker service and enable it to start on boot with the following commands.
sudo systemctl start docker
sudo systemctl enable docker

Starting-the-Docker

Step 11: Verify Installation

  • Check Docker version and run a test container with the following commands.
docker --version
docker run hello-world

15-Verifying-The-Docker

Now, your AWS CentOS instance is equipped with Docker Engine, ready to deploy and manage containers efficiently.

Docker On Centos – FAQ’s

How to start Docker engine in Linux?

Start the docker engine in linux with the following command:

sudo systemctl start docker

How to start Docker engine from command line?

On running the following command in command line you can start the docker engine.

sudo systemctl start docker

Can you install Docker engine directly to server?

Yes, you can install the docker engine directly on the server.

How to check the Docker engine version?

On using the following command you can check the docker engine’s version.

 docker --version

How do I know if Docker is installed on CentOS?

You can verify the installation of docker on CentOs with the followign command:

docker --version


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads