How to install Docker on Amazon Linux 2

To install Docker on an Amazon Linux 2 EC2 instance, you can use the following steps:

  1. Connect to your EC2 instance via SSH.
  2. Update the package index by running the following command:
sudo yum update -y
  1. Add the Docker repository to your system by running the following command:
sudo amazon-linux-extras install docker
  1. Install Docker by running the following command:
sudo yum install -y docker
  1. Start the Docker service by running the following command:
sudo systemctl start docker
  1. Verify that Docker is running by running the following command:
sudo docker info
  1. To make sure Docker starts automatically after reboot
sudo systemctl enable docker

Please note that these steps are for Amazon Linux 2 EC2 instances. The process may be different for other Linux distributions or cloud providers.

Leave a Comment