Docker installation with very easy steps on AWS Ec2 instance

In this article we will perform Docker installation as well as we will configure “Container” and “Images” with easy steps on AWS Ec2 instance. We are using Amazon Linux distribution and assuming that you have already created your AWS account if not you can refer this article Create AWS free tier account. Once you logged into AWS account and connected to your AWS Ec2 instance you can follow below steps to perform Docker installations.

1.Get ready your Ec2 Instance

When you are logged into your AWS Ec2 instance you have to update all the packages, before that you have to switch to root user account using command sudo su and then you can use below command;

yum update -y

2. Install Docker

Once you used above command it will update packages on ec2 instance or it will give message “no packages marked for update” it means your ec2 instance already have all the latest packages installed.

Now, you can install Docker using below command,

#yum install docker -y

This command will installed Docker softwares and its dependencies.

3.Verify Docker Installation

#which docker


#rpm -qa docker

4.Start Docker

Now, you can check status and start Docker service using below commands;

#docker info
#service docker status
#service docker start

You can find all the status of the Docker using command “docker info” It will provide you all the information.

#docker info

5.Check Available Docker Images/Containers

Now, you can check available Docker Images  and Containers with help of below commands, if you don’t know about what is Docker Image, what is Docker Container, what is Docker Client and what is Docker Hub then you go through this Docker-Containers Lets understand it with simplest way article to easily understand all the terms.

“docker images” command used to check available images on your Docker server or Docker engine

#docker images

“docker ps” (ps stand for process status) command is used to check all running containers and “docker ps -a” (-a stands for all) command is used to check all running as well as stopped containers.

#docker ps
#docker ps -a

6.Download Docker Images

Now, you required to create and download Docker images of various distributions for that you can use docker file or you can directly download Docker images from

You can also download Docker images using below command,

#docker run -it ubuntu /bin/bash

Now, in below example I am installing “ubuntu” image. So, as you can see as soon as we run above command Docker search ubuntu image in local machine first and in case it not found Docker can pull image from

7.Verify Installed Images/Containers

As soon as you run above “docker run -it ubuntu /bin/bash” command your Docker container will be ready and you will be reached within that (ubuntu) Container. You can verify it using below command;

#cat /etc/os-release

Now, you can enter exit command and you will be exit from the container and your container will also stopped. You can now use below command to check available images on your Docker server/engine.

#docker images

This time you will see “ubuntu” image which we have installed.

Now, check available containers with below command;

#docker ps -a

You can find now, one Container available which is in stopped state.

8. Docker Commands Best Practices

Command to search docker images that available on docker hub

#docker search centos

Command to start container; you can use container name or id to start container.

#docker start 755aeea073eb

Command to go to inside the running containers; use container name or id to go inside running containers

#docker attach 755aeea073eb

Hope this article helpful you. Please like, share and subscribe to


Related Article:

Docker-Containers Lets understand it with simplest way

What is Terraform? Let’s understand with easy steps 


DevOps Article

DevOps Article. Your Learnings Hub.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.