To install Docker on an Amazon Linux 2 EC2 instance, you can use the following steps:
- Connect to your EC2 instance via SSH.
- Update the package index by running the following command:
sudo yum update -y
- Add the Docker repository to your system by running the following command:
sudo amazon-linux-extras install docker
- Install Docker by running the following command:
sudo yum install -y docker
- Start the Docker service by running the following command:
sudo systemctl start docker
- Verify that Docker is running by running the following command:
sudo docker info
- 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.