Skip to main content

Install Docker on EC2

1) Launch EC2 instance , the one with docker support on it 

2) Then follow simple below 4 instructions  

Update yum for any package 
The install docker 
then start the docker service 
register the ec2-user in docker sudo group to execute commands without sudo permission 

a) sudo yum update -y 
b) sudo yum install -y docker
c) sudo service docker start
d) sudo usermod -a -G docker ec2-user

you can verify the  docker installation by running some sample docker commands like 
docker image ls 
docker ps 

reboot the system to take an effect of sudo group

Comments

Popular posts from this blog

Installing Jenkins on RedHat on AWS EC2

1) Create an EC2 Instance from the aws amazon.com UI with basic free tier configuration and select RedHat AMI 2) Generate KeyPair if its not already generated 3) Store the key-pair in secure location in your system and change its permission to 400 which means only the owner can utilize it  4) I'm using windows wsl , so it did not let me modify the permission in the download directory so I copied the file in linux direcotry ( /home/<username>/) and then changed its permission using chmod sudo chmod 400 myec2login.pem 5) Then I logged in to my ec2 instance using ec2-user which is default user for ec2 instances providing the path of this file  ssh -i "/path/to/ec2pemFile" ec2-user@ec2IPaddress 6) First installed the java version 8 on the instance as Jenkins needs java 8 run time sudo yum install java-1.8.0-openjdk-devel.x86_64 In case there was already a different version of java available, you have to run alternative config command on linux to select this version to ...

Quick Sample Docker Java Application Demo

A quick demo for Java Application container In this page, I'll show you a demo to quickly build an image and run a docker container.  To run this you must have a docker installed .  I'm going to use this on Ubuntu/Linux On windows subsystem.  1) You can create a directory for this demo using linux command    mkdir docker-demo-java 2) Change directory to new folder using cd command as cd docker-demo-java 3) create a sample java file DemoJavaContainer.java and print a sample message as "A sample docker java application demo" class DemoJavaContainer{ public static void main(String ar[]) { System.out.println("A sample docker java application demo"); } } 4) Then write a sample docker file named Dockerfile and write the below content from java:8 COPY . /var/java WORKDIR /var/java RUN javac DemoJavaContainer.java CMD ["java","DemoJavaContainer"] 5) save the file in the project directory 6) run command : docker build -t sample-docker-java-...