Skip to main content

Command Palette

Search for a command to run...

Docker Installation on AWS EC2

Published
1 min read

While practicing DevOps, I wanted to set up Docker on an AWS EC2 instance. I decided to document the exact steps I followed. These are my personal learning notes, shared in case someone else is trying the same.


Steps I Followed

1. Launch EC2 Instance

  • Selected Amazon Linux 2 AMI.

  • Connected to the instance through MobaXTerm.

2. Check Docker Availability

docker info

Output showed command not found, which means Docker was not installed.

3. Switch to Root and Update Packages

sudo su
sudo yum update -y

4. Install Docker

sudo yum install docker -y

5. Start Docker Service

sudo service docker start

6. Verify Installation

docker info

This time I got permission denied. Reason: the default ec2-user does not have Docker permissions.

7. Add User to Docker Group

sudo usermod -aG docker ec2-user

8. Restart Session

exit
exit

Then I reconnected to the instance.

9. Final Checks

docker -v
docker images

Now Docker was installed and working.


What I Learned

  • Errors are part of the process; they usually point towards what is missing.

  • Adding the user to the Docker group is necessary to avoid permission issues.

  • Writing down steps makes troubleshooting and revisiting the setup much easier.

L

Great guide! Installing Docker on AWS EC2 is a fundamental step for containerized application deployment. For smoother local development, I’ve started using ServBay (servbay.com) — it lets me spin up isolated environments quickly, so I can test changes without worrying about my main setup.

Documenting DevOps Learning Journey

Part 30 of 40

In this series, I document my day-by-day DevOps learning journey by building projects using AWS, Docker, Kubernetes, Terraform, and CI/CD, and sharing lessons, challenges, and practical insights along the way.

Up next

Docker Basics on AWS

While learning Docker on AWS EC2, I realized that restarting an instance brings up a few challenges. For example, Docker does not automatically start after an EC2 reboot. Below are the step-by-step notes I made while practicing. Starting and Checking...

More from this blog

Documenting My DevOps Journey

40 posts