Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 22:Pushing a docker image to docker hub

                                                      Pushing a docker image to docker hub

First you need to have an account in docker hub.
Create an account in docker hub.
https://hub.docker.com/
Create an instance in aws console (refer how to create an instance)
Login to gitbash(refer how to login to an instance  in ssh client)
Install docker in an instance
Check the service is running or not.
Switch to root user----------------->sudo su
To install docker------------------->yum install docker
To start the service--------------->systemctl start docker
To check whether the service is running or not ---------------->ps-ef | grep -i docker



Now start the service



Now the server is running or not



Now install nodejs application inside the docker and push the image to docker hub.
First make a directory name as docker
Inside the directory install nodejs application
You can get nodejs from https://github.com/luksa/kubernetes-in-action/tree/master/chapter02/kubia
From that you can pull the image to your local.



Now get nodejs file.
Go to the link click on dockerfile,click on raw copy the url.





Click on raw you will get a page there copy the url



Go to the git bash and enter the command
#wget https://raw.githubusercontent.com/luksa/kubernetes-in-action/master/chapter02/kubia/Dockerfile



Now click on app.js file copy the file and install in git bash



Make sure that you should have the both files in your docker folder



Now build the image
#docker build -t nodejs.



Now check whether image is build are not
Use the command ;docker images



Now run the container---------------->docker run -d -p<ports><imagename>
docker run -d -p 8080:8080 nodejs



Now check whether container running or not:-------------------------->docker ps



Now check in the browser by giving Ip addresss
ipaddress:<hostport>




Its working..
Now push this image to docker hub.
Login to the docker hub account
Create a repository
Tag this image and push to docker hub.



Click on create repository 
Copy the right side command and paste in any wordpad
We will use those while tagging the images and pushing the image to docker hub.



Now give name to repository
Eg:nodejs
And Click on create



You will get the page like this
And copy the right side command .We will use this to push the image to docker hub.



Now go to gitbash login to the docker hub----------------->#docker login
Enter your docker id  and password



Now tag the image
#docker tag <image><dockerid>/repository name:latest
docker tag nodejs<username>/nodjs-web:1



Now push the image to the docker hub
docker push<username>/nodjs-web:1



Now go the  docker hub whether  the image is pushed or not



Execrise: 1)Build images of httpd,flask app,nodejs app and push them in docker hub

                2) Take an redhat ami install docker and build an images and try push the images to docker hub.

Comments

Popular posts from this blog

Lab 21:Installing docker in instance and build an image

Lab 5: Installing Nginx in EC2 instance