I have created a pipeline in Jenkins whose steps are:
- git pull(retrieve the app from GitHub)
- build (maven package the app)
- building an image
- running an image
code for running the image is
docker run -d --name **application_name** -p 8081:8081 **application_name**
I need an if-else condition to check if the image has been created or not. for eg.
if (image not created)
create the image
else
different step
I need this because every time I change something in code, Jenkins throws an error stating that the image is already running.