Ref: https://learn.cantrill.io/courses/1820301/lectures/41301612 and https://learn.cantrill.io/courses/1820301/lectures/41301615
sudo dnf install docker - Install Docker
sudo service docker start - Start the Docker service in the instancedocker ps - List all running containers in the instance
sudo usermod -a -G docker ec2-user - add local ec2-user to the Docker group (gives permissions to interact with Docker Engine)sudo su - ec2-user - login to instance with ec2-user (needed if you're using EC2 session manager instead of Instance Connect or SSH)docker ps should now list all running containers without an error (but no containers will be running initially)# Build Docker Image
cd container
docker build -t containerofcats .
docker images --filter reference=containerofcats
# Run Container from Image
docker run -t -i -p 80:80 containerofcats
# Now connect to EC2 instance via HTTP, you will be greeted with a cats webapp :)
# Upload Container to Dockerhub (required for STEP3, can skip otherwise)
docker login --username=<YOUR_USER>
docker images
docker tag <IMAGEID> <YOUR_USER>/containerofcats
docker push <YOUR_USER>/containerofcats:latest