The best way to get Jenkins to "update" the docker working container when the image has been updated

Our organization is relatively new to Docker and Jenkins. We are working on the development of our CI pipeline with updating the Java (Java) source code before launching the application.

Jenkins is currently using the Cloudbees Docker build and publish plugin to update the image after a successful build. It just pulls the database image (JBoss) and updates it with the WAR WAR file that he just created (via Maven).

We use the build step โ€œSend commands via SSHโ€ for SSH to the server on which the container is currently running, stop the container with the specified image identifier and pull it out again and then start the container.

However, I know that there must be a better, more elegant way to do this. Surprisingly, I have problems finding documentation on how to do this. Any advice would be appreciated. Please let me know.

+5
source share
1 answer

If you want to use only Docker, you can do much more. Using Jenkins with Docker is already a good step forward. Perhaps you could docker stop instead of ssh shutdown , but that will not improve the situation.

There are tools like Openshift and Fabric8 to help you create CI and CD workflows. This should help. Please note that if you look at them closer, you will see that some of them are built on top of Kubernetes .

If you're looking for a ready-to-use workflow, try Openshift. Take a look at this architecture overview . He has a Jenkins plugin that make your life easier.

If you want to take a step forward at the same time, you create your own workflow, no doubt Kubernetes is the way to go. Itโ€™s just putting tons of the object to create a cluster of containers without having to impose any kind of workflow on you. Check out this review and starting with CoreOS docs .

+1
source

Source: https://habr.com/ru/post/1243062/


All Articles