Everybody want to deploy micro-services. Docker is the most powerful and popular tool which is help to containerizing application. It is help to deployment faster and more efficient. So, In this blog we will install and run a simple docker container on AWS EC2 instance.
Prerequisites
- You need AWS management console [ Account]
- One already running EC2 Instances [ Amazon Linux or Ubuntu]. If you don’t know how to launch instances read this How to create EC2 Instance
- SSH access to the EC2 Instances.
Step 1: Launch EC2 Instance and Access it using SSH
Step 2: Install Docker on EC2
- For Amazon Linux
- First update the system and Install Docker
sudo yum update -y
sudo amazon-linux-extras enable docker
sudo yum install -y docker
- For Ubuntu Linux
sudo apt-get update -y
sudo apt install -y docker.io
Step 3: Start Docker and Enable it
- Run the following command on your server to start and enable docker.
sudo systemctl start docker # to start the run service
sudo systemctl enable docker # to enable the Docker service
sudo systemctl status docker # to verify the docker
Step 4: Add user to Docker Group [Optional]
- If you want run docker without using sudo, So add your user to the Docker group
sudo usermod -aG docker ec2-user # for amazon user
sudo usermod -aG docker ubuntu # for ubuntu user
Step 5: Run a Docker container
- Now, run the simple docker container using the official Nginx image.
- Pull the Nginx Docker image
sudo docker pull nginx
- Now, Run the Nginx container
sudo docker run -d -p 80:80 --name cloudwithyuvi nginx
- -d = Run in background
- -p 80:80 = Port maps 80 of the container to port 80 of the EC2 instance
- –name cloudwithyuvi = give name of the container.
- Now, verify the container is running or not
sudo docker ps
Step 7 : Access your container webserver
- Open your browser and paste your EC2 instance public IP
http://ec2-public-ip # paste your ec2 public IP
- Now, You can see the default Nginx welcome page, it’s mean your container is successfully running.

Step 8: Manage Docker Container
- If you see all running containers:
sudo docker ps
- If you want stop your conatiners:
sudo docker stop cloudwithyuvi # replace your container name
- If you want to restart your containers:
sudo docker start cloudwithyuvi # replace your container name
- If you want delete your containers:
sudo docker rm cloudwithyuvi # replace your container name
Amazing, you have successfully install docker on AWS EC2 instance and deploy Nginx webserver using docker. It is help to deploy and manage application in isolated environments.


Awesome https://shorturl.at/2breu
Awesome https://t.ly/tndaA
Good https://t.ly/tndaA
Very good https://is.gd/N1ikS2
Awesome https://is.gd/N1ikS2
Good shout.
live resin gummies area 52
thc tinctures area 52
disposable weed pen area 52
Google Analytics Alternative