Docker Registry: A repository of images. Registries are public or private that contain images for download. Some registries allow users to upload images to make them available to others
Dockerfile: A configuration file with build instructions for Docker image.Dockerfile automate the steps for image customization.
As we discussed two types of registry are available:
Public Docker Registry: Users just want to explore or want a in-build solution. They can use hosted docker registries. Docker hub is the example of public registry where user can host the registry.
Private Docker Registry: Lot of organization have security concern for public docker registry.
- Developers pushes a Commit to Github
- Github uses a webhook to notify jenkins for update
- Jenkins pull the Github repository, including the dockerfile describing the image as well as the application and test code
- Jenkins builds a docker image on the jenkins slave node
- Jenkins intestates the docker container on the slave node and does appropriate testing.
- If image are successful the image is pushed to docker registry.
- An tester/ user an pull the image from the docker registry and use it.
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm –import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins
Installing Github plugins on jenkins : http<ip>:8080
Create slave node in Jenkins->configuration->Manage nodes
Create a project in jenkins and configure it for source code management
Now map the gitlab in jenkins project
Note: I have created local gitlab in my centos follow the steps mentioned in below blog: https://www.server-world.info/en/note?os=CentOS_7&p=gitlab
Even we can create local docker registry as well
yum install docker-registry
systemctl start docker-registry
In this blog we have created gitlab,jenkins and docker registry.
Now push docker file and code to gitlab. Configure the webhook in git and configure jenkins.
Below is the git configuration
All the components of CI/CD are ready in-house lab.