jenkins DockerHub - ghdrako/doc_snipets GitHub Wiki
Click on Manage Jenkins in the left-hand menu to install the plugins
Click on Plugin Manager. Four tabs will appear. Click on the Available tab and select
Docker,
docker-build-step,
Cloudbees Docker Build,
Publish plugins
Click Install without restart.
After installation, check Restart Jenkins when installation is complete and no jobs are running.
Wait until it is done, and the dashboard is shown. Click on the project's name, that is, hit_count
Click Configure in the left-hand menu to modify the project configurations
Modify the details in the Build tab only. Click on it and select Add build step. A larger menu than the one you saw before will show up. If you see Docker Build and Publish in that menu, it verifies that your plugins were installed successfully. Click Docker Build and Publish
In Registry Credentials, click Add. Then select Jenkins from the drop-down menu
A pop-up box will appear. Enter your Docker Hub username and password. Then, click Add:
Now, in Registry Credentials, click the first drop-down menu and select the credentials that you entered in the previous step. Then, enter / in the Repository Name field.
Remove the Execute Shell option Uploading the Code to GitHub, by clicking the Red X at the top right.
Click Save to save the new configuration (you will have only one build step, which is the Docker Build and Publish)
Click Build Now again in the left-hand menu and in the Build History option, follow the progress of the image build. It will have the same name that you specified in Repository Name in the previous step. Jenkins will add the docker build step by itself because you chose it from the plugins. If the image passed the build successfully, Jenkins will use your Docker credentials and automatically connect to Docker Hub or any registry you specify in Repository Name. Finally, Jenkins will push the new image automatically to your registry, which is your Docker Hub registry in this exercise.