Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to install and enable docker on command line with EC2 instance

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)
Comment

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
Comment

PREVIOUS NEXT
Code Example
Shell :: Failed to install gems via Bundler. 
Shell :: naming an stash 
Shell :: remove all cache ubuntu 
Shell :: stylelint fix 
Shell :: git credential cache 
Shell :: powershell arry initialize add 
Shell :: npm firebase-tools 
Shell :: remove mongodb completely ubuntu 
Shell :: install datetime 
Shell :: uncompress tar.xz linux 
Shell :: install ifconfig on ubuntu 
Shell :: remove systemd service 
Shell :: delete local branch 
Shell :: node-sass: command not found 
Shell :: install nasm ubuntu 
Shell :: Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state 
Shell :: npm install behind proxy 
Shell :: ssh remove whole folder command 
Shell :: clean docker images and containers 
Shell :: install docker kali linux 
Shell :: permission denied: ./deploy.sh 
Shell :: install glibc 
Shell :: gitlab ci allow failure 
Shell :: stop minikube 
Shell :: count lines of code in github repo 
Shell :: m1 install gradle 
Shell :: linux check used space in folder 
Shell :: install opera ubuntu terminal command 
Shell :: ffmpeg webm to mp4 
Shell :: firebase cli brew 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =