How do I deploy my Jenkins build on a droplet?

Posted January 25, 2020 3k views

I have Jenkins set up with nginx in a docker container on a droplet. I installed the plugin Deploy to Container on Jenkins. Now I need to set up a Tomcat server to deploy the Jenkins war file to.

So where does my Tomcat server go? And why do I need another server when I have a droplet already? Do I need a new docker container on my droplet for the tomcat server?

My Jenkinsfile deploy stage currently looks like this, but I need to context?

stage('Deploy') {
            steps {
                echo 'Deploying...'
                sh 'deploy contextPath: null, war: "/usr/share/jenkins/jenkins.war"'

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


It would not be a problem to run your Tomcat server on your existing Droplet. You can take a look at this tutorial here on how to install Tomcat on your Droplet:

Regarding the Pipeline itself, it would really depend on what setup you would like to have at the end, for example, if you like Jenkins to build your Java project and then containerize it and deploy it on the same server? If this is the case you could have a similar setup to this one:

That way your Jenkins container would have access to the Docker service on your host, and you can spin up containers from inside Jenkins and start them on your Droplet directly.

If you prefer not to run your app in a container, you could take another approach and share a volume between your Jenkins container and your Droplet, then with the copy command that you already have, you could copy the war file from your Jenkins container to the share volume so that the war file would be available on your Droplet where you could have your Tomcat running.


by Justin Ellingwood
Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation...