Installing Docker on AWS EC2 Ubuntu Instance

Steps-:
To install Docker on an AWS EC2 Ubuntu instance, follow these steps:
Connect to your EC2 instance via SSH or the EC2 console.
Update the package list:
sudo apt update && sudo apt upgrade -y
- Install prerequisite packages:
sudo apt install ca-certificates curl gnupg lsb-release
- Add Docker's GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- Add the Docker repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Check the Docker version:
docker -v
- Add your user to the
dockergroup:
sudo usermod -aG docker $USER
- Log out and back in or run:
newgrp docker
- Test Docker by running a container:
docker run hello-world
This installs Docker on your AWS EC2 Ubuntu instance and allows you to run Docker commands without sudo. Let me know if you have any other questions!




