sudo yum update -y
sudo amazon-linux-extras install docker -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -a -G docker ec2-user (to avoid sudo command usage)
newgrp docker (to avoid sudo command usage)
sudo amazon-linux-extras install docker -y
sudo service docker start
# Install Docker Engine on EC2 Instance
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
LOGOUT and login
sudo su - ec2-user
# Build Docker Image
cd aws-sa-associate-saac02/09-Containers-ECS/container_of_cats/container
docker build -t containerofcats .
docker images --filter reference=containerofcats
# Run Container from Image
docker run -t -i -p 80:80 containerofcats
# Upload Container to Dockerhub (optional)
docker login --username=YOUR_USER
docker images
docker tag IMAGEID YOUR_USER/containerofcats
docker push YOUR_USER/containerofcats:latest
sudo yum update -y
sudo usermod -a -G docker ec2-user