How to Install Docker on Amazon Linux

Docker is a tool which helps to automate the deployment of applications in containers to make sure that particular applications can work efficiently in different environments without any errors.It helps developers to build, ship, and run application faster and more reliable way. In this article, we will get to know how to install docker on Amazon Linux

Prerequisites

Steps to Install Docker on Amazon Linux

Step 1: Logging in to the AWS account

Firstly login to your AWS free tier account from here. Now in the search box search for ‘EC2’.Make sure that you have a running EC2 instance as shown below.

Step 2: Connecting to EC2 Instance

Now just select the running instance and on the top right corner click on ‘Connect’ to connect to the Linux server and in the next tab you will see various options to connect to the Linux server you can choose one of the method.For now I am choosing the first option ‘EC2 Instance Connect’ and just click on the ‘Connect’ at the below corner of the page as shown below.

Step 3: Installing Packages and Dependencies

After establishing a secure connection to the Linux server the window will be appeared as shown below.

Now run the command to update the Linux system. After updating the linux system run the command ‘sudo yum install -y docker’ to install the docker package into the Linux system.After the sucessful installation you can see the screen as shown below.

sudo yum update -y

Step 4: Start the Docker Service

Now run the command to start the docker service and also we need to enable the docker when we start the docker to enable run the command. After running the command sucessfully you see the screen as shown below.

sudo systemctl enable docker
sudo systemctl start docker

Step 5: Check the Docker Installation

To make sure that the docker is installed successfully in the Linux we can run the command if it returns the version of the docker as shown below it means that docker has been successfully installed else check the above steps carefully.

docker --version

Conclusion

This guide successfully walked you through installing Docker on your Amazon Linux EC2 instance. By following these steps, you’ve ensured that Docker is up and running, ready to containerize your applications for efficient and reliable deployment across various environments. Remember to verify the installation using the docker –version command as instructed.

Install Docker on Amazon Linux – FAQs

Do I need root access to install Docker on Amazon Linux?

Yes, installing Docker requires root privileges. Throughout the process, you’ll see commands prefixed with sudo to execute them with administrative rights.

Is there a way to check if Docker is already installed on my Amazon Linux instance?

Absolutely! Before going through the installation steps, you can simply run docker –version in your terminal. If Docker is already installed and functional, this command will display the Docker version running on your system. If Docker isn’t installed, the command will return an error message.