Apply pending updates using the yum command:
sudo yum update
Search for Docker package:
sudo yum search docker
Get version information:
sudo yum info docker
Install docker, run:
sudo yum install docker
Add group membership for the default ec2-user so you can run all docker commands without using the sudo command:
sudo usermod -a -G docker ec2-user
id ec2-user
newgrp docker
Enable docker service at AMI boot time
sudo systemctl enable docker.service
sudo systemctl start docker.service