Skip to main content

Command Palette

Search for a command to run...

Installing Docker on AWS EC2 Ubuntu Instance

Updated
•1 min read•View as Markdown
Installing Docker on AWS EC2 Ubuntu Instance

Steps-:

To install Docker on an AWS EC2 Ubuntu instance, follow these steps:

  1. Connect to your EC2 instance via SSH or the EC2 console.

  2. Update the package list:

sudo apt update && sudo apt upgrade -y
  1. Install prerequisite packages:
sudo apt install ca-certificates curl gnupg lsb-release
  1. Add Docker's GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  1. 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
  1. Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Check the Docker version:
docker -v
  1. Add your user to the docker group:
sudo usermod -aG docker $USER
  1. Log out and back in or run:
newgrp docker
  1. 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!

More from this blog

Untitled Publication

12 posts