Skip to content

gakas14/Docker-on-AWS-EC2-Instance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Docker-on-AWS-EC2-Instance

Docker Installation on AWS EC2 Instance. This is to show how to install Docker on an AWS EC2 instance. We'll walk you through setting up Docker on your Amazon EC2 server.

Launch Amazon EC2

Screen Shot 2024-01-30 at 7 46 47 PM Screen Shot 2024-01-30 at 7 47 08 PM

Connect to instance

Screen Shot 2024-01-30 at 7 48 41 PM

To Update the instance

  sudo yum update -y

Install Docker

sudo yum install docker -y
Screen Shot 2024-01-30 at 8 03 30 PM

Start Docker

sudo service docker start
Screen Shot 2024-01-30 at 8 05 05 PM

Check the service

sudo service docker status
Screen Shot 2024-01-30 at 8 06 46 PM

Check the Docker version

sudo docker version
Screen Shot 2024-01-30 at 8 10 16 PM

Let's search and pull the nginx image

sudo docker search nginx
sudo docker pull nginx
Screen Shot 2024-01-30 at 8 14 30 PM

Check for the images on the docker

sudo docker images
Screen Shot 2024-01-30 at 8 15 37 PM

Let's create a container with the nginx image

sudo docker run -d -p 80:80 nginx
sudo docker ps
Screen Shot 2024-01-30 at 8 20 02 PM

Use the EC2 instance public IP to check for the Nginx welcome page

Screen Shot 2024-01-30 at 8 21 45 PM

to stop a container

sudo docker stop <id>

to remove the image

sudo docker rmi <image_name/image_id>