TASK 2 - DEVOPS (1)
Create a container image that's has Jenkins installed using dockerfile and when we launch this, it should automatically starts Jenkins service in the container.
So to create docker image the best option is Dockerfile.
Step1 : Write all the feature in Dockerfile that you want to add in your image. I am creating image from centos that i pulled from dockerhub
This is Dockerfile i wrote to create image that will have active Jenkins running inside it. After this we have to save this file.
Step2 : Now from this Dockerfile to create image from this we have run below command
docker build -t myimage:v1 .
this will create image name myimage having version v1 you can give any name to image. Here at the end i had given ' . ' because i am in same location where i had saved Dockerfile if you are at another location then give path of that location.
Step3 : It's all done image is created to check run below command
docker images
Step4 : To launch container of this image use below command and after running this new container will be launched that will have running Jenkins inside it .
docker run -dit --name any_name myimage:v1
Step5: To use Jenkins first you should know ip of that container (use inspect command to know ip). So your Jenkins URL is https://your_ip.8080 (by default Jenkins work on the port no 8080) . If you want public ip to your Jenkins then use ngrok .
After this they will provide you file that will have your Jenkins password unlock that file and type password and now Jenkins will get open.
Second part of this task will be completed soon .
Thank you to read this article. If you have any query or suggestion, please let me know