11/24/2021»»Wednesday

Install Docker On Ec2 Ubuntu

  1. Install Docker On Ec2 Ubuntu Windows 7
  2. Install Docker On Ec2 Ubuntu Download
  3. Install Docker On Ec2 Ubuntu 20.04

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.

Let’s Install Docker on EC2 Instance. In this tutorial, we will use Amazon Linux to install docker. Amazon Linux/Amazon Linux2 is the Linux Operating System used in EC2 Instance. Step 1– Log to Linux EC2 Instance and update it. $ sudo yum update -y. Step 2– Install docker using Yum command $ sudo yum install docker -y. Install Docker and start Docker service. Also, enable the docker service so that the docker service starts on system restarts. Yum install docker -y. Systemctl enable docker && systemctl start docker. Create proper yum repo files so that we can use yum commands to install the components of Kubernetes.

1.Get ready your Ec2 Instance

DockerEc2

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;

Docker

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,

This command will installed Docker softwares and its dependencies.

3.Verify Docker Installation

OR

4.Start Docker

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

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

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 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.

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 hub.docker.com.

Install docker on ec2 ubuntu software

You can also download Docker images using below command,

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 hub.docker.com.

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;

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.

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

Install Docker On Ec2 Ubuntu Windows 7

Now, check available containers with below command;

Ubuntu

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

8. Docker Commands Best Practices

Install Docker On Ec2 Ubuntu Download

Command to search docker images that available on docker hub

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

Install Docker On Ec2 Ubuntu 20.04

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

Hope this article helpful you. Please like, share and subscribe to https://devopsarticle.com

Reference:

Related Article:

Most Viewed Posts