Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Install Docker Engine on EC2 Instance

# 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
Source by learn-cantrill-labs.s3.amazonaws.com #
 
PREVIOUS NEXT
Tagged: #Install #Docker #Engine #Instance
ADD COMMENT
Topic
Name
4+1 =