For Amazon Linux 2023:
>sudo yum install -y docker
Start the Docker service.
>sudo service docker start
(Optional) To ensure that the Docker daemon starts after each system reboot, run the following command:
>sudo systemctl enable docker
Add the ec2-user to the docker group so you can execute Docker commands without using sudo.
>sudo usermod -a -G docker ec2-user