Creating Docker hosted repository in Nexus and pushing the docker image through Jenkins - DeekshithSN/CICD_Java_gradle_application GitHub Wiki
Pre-requisite
- We need to have Jenkins and nexus server up and running (by default Jenkins runs on 8080 and nexus at 8081), to install on ubuntu refer link
- On Jenkins host we need to install docker
Initial setup
In nexus click on gear button --> click on repositories --> click on create repository ( below image can help in creating )
once we click on create repository ( types of repository will be listed ) --> click on docker(hosted)
fill out the details in Name ( unique name ), enable checkbox beside to HTTP and enter a valid port ( preferred 8083 ) once that click on create repository
Once this set up is done in jenkins host we need to setup Insecure Registries. to do that we need to edit or if not present create a file /etc/docker/daemon.json
in that file add details of nexus
{ "insecure-registries":["nexus_machine_ip:8083"] }
once that's done we need to execute systemctl restart docker
this is to apply new changes, also we can verify whether registry is added or not by executing docker info
once this is done from jenkins host you can try docker login -u nexus_username -p nexus_pass nexus_ip:8083