Deploying Flowable in a Docker Container and MySQL (Part 1)

Deploying Flowable in a Docker Container and MySQL (Part 1)

This is the first part of our “Deploying Flowable in a Docker Container and MySQL” series. In this post, you will learn how to adapt Flowable’s war files to use MySQL as a database source. Once this is done, we will deploy them in a dockerized environment.

What you’ll need

  • About 30 minutes
  • Docker Desktop for you operating system already installed. For this tutorial, we used Docker Desktop for Windows. You can download it from here.
  • Download Flowable war files. You can download them from here. We need a fresh copy without any modification.
  • Download MySQL Connector/J. You can download it from here.


In this article, you will learn how to deploy Flowable’s war file in a dockerized Tomcat environment and connecting to a container running MySQL. Once you have the images, we will use Docker Compose for defining and running a multi-container Docker applications.

If you would like to know how to compile from scratch Flowable’s source code so that is uses MySQL as default database source, and afterward deploy it in a dockerized environment, please have a look at our post Run Flowable BPM using Docker and MySQL.

So let’s get started!!

Folder Structure

This is the folder structure that we will be using for this tutorial:

  |- flowable-docker 
       |- wars 
           |- flowable-admin.war 
           |- flowable-idm.war 
           |- flowable-modeler.war 
           |- flowable-task.war 
       |- tomcat-users-xml 
       |- Dockerfile 
       |- docker-compose.xml

Creating the Tomcat User file

So that we can access the management app’s web page that Tomcat offers, we can add some user with valid credentials and roles. Create the following file and called tomcat-users.xml under flowable-docker folder:

<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns=""
              xsi:schemaLocation=" tomcat-users.xsd"

Here, we have created a user called tomcat, with tomcat as password, and assigned the following roles: tomcat,standard,manager-gui,manager-status,manager-script,manager-jmx.

Creating the Dockerfile

Docker has a simple file format called Dockerfile, which uses to specify the layers of an image. Having said this, let’s go ahead and create a Dockerfile using your favorite text editor:

# Use an official Tomcat runtime as a parent image 
FROM tomcat:8.0-jre8 

ENV DIRPATH /usr/local/tomcat 

# Copy Tomcat users into the container at /conf 
COPY ./tomcat-users.xml $DIRPATH/conf 

# Copy flowable-admin war file into the container at /webapps 
COPY ./wars/flowable-admin.war $DIRPATH/webapps 

# Copy flowable-idm war file into the container at /webapps 
COPY ./wars/flowable-idm.war $DIRPATH/webapps 

# Copy flowable-modeler war file into the container at /webapps 
COPY ./wars/flowable-modeler.war $DIRPATH/webapps 

# Copy flowable-task war file into the container at /webapps 
COPY ./wars/flowable-task.war $DIRPATH/webapps 

# Make port 8080 available to the world outside this container 
EXPOSE 8080 

# Run CMD "" when the container launches 
CMD ["", "run"]

This Dockerfile is very simple, but that’s all you need to run a container with Tomcat. This is what the file does:

  1. COPY the file tomcat-users.xml to /user/local/tomcat/conf
  2. COPY flowable-admin war file into the container at /webapps
  3. COPY flowable-idm war file into the container at /webapps
  4. COPY flowable-modeler war file into the container at /webapps
  5. COPY flowable-task war file into the container at /webapps
  6. Make port 8080 available to the world outside this container
  7. Run CMD when the container launches

Creating docker-compose.yml file

In the file, we specify container for MySQL (mysql-db), and Tomcat container (tomcat). Notice that we have included adminer database manager, so that we can access the database from a web interface.

version: '3.7'
    image: mysql:5.7.26
    container_name: flowable-mysql-mysql-5.7.26
    command: --default-authentication-plugin=mysql_native_password
    restart: always
      - db_data:/var/lib/mysql
      MYSQL_ROOT_PASSWORD: flowable
      MYSQL_USER: flowable
      MYSQL_PASSWORD: flowable
      MYSQL_DATABASE: flowable
      - "3306:3306"
      - flowable-mysql
    image: adminer
    restart: always
      - 18080:8080
      - flowable-mysql

    build: .
    image: tomcat:8.0-jre8
      - "8080:8080" # Forward the exposed port 8080 on the container to port 8080 on the host machine
      - mysql-db # This service depends on mysql. Start that first.
    restart: always
      - flowable-mysql

# Networks to be created to facilitate communication between containers

# Volumes
    db_data: {}

So that the containers can communicate between them, we have created a network that we have called flowable-mysql.

Let’s have a quick look at MysQL container’s configuration. When you start the mysql image, you can adjust the configuration of the MySQL instance by passing one or more environment variables. Do note that none of the variables will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup.

With the environment variables that we are configuring, according to the official documentation, the database flowable will automatically be created, and the users root and flowable will be granted all privileges.

Modifying War file to use MySQL

Because of license constraints, the official Flowable’s war file do not come with the MySQL connectors included. So, we will do some modifications to the war files, so that when they are copied to our Tomcat container, they can be deployed with MySQL connector.

Download MySQL Connector/J. Once you have it, do the following steps:

  1.  Open a war file using Winrar or similar.
  2. Navigate to folder WEB-INF/lib and copy the MySQL Connector/J.
  3. Now, go to WEB-INF/classes, and open file for editing.
    • Comment the lines in which it specifies that the app should connect to an H2 database.
    • Uncomment the lines in which it specifies that the app should connect to a MySQL database and modified as follow:

Note that in the datasource url, we have used the name of the MySQL container as address.

Repeat the above steps for each war file.

Start the containers

Run the following command and build the images:

$ docker-compose build
mysql-db uses an image, skipping
adminer uses an image, skipping
Building tomcat
Step 1/9 : FROM tomcat:8.0-jre8
 ---> 8391ef8f6ae4
Step 2/9 : ENV DIRPATH /usr/local/tomcat
 ---> Using cache
 ---> 79fb5ffc0bc1
Step 3/9 : COPY ./tomcat-users.xml $DIRPATH/conf
 ---> a6f497f3bb44
Step 4/9 : COPY ./wars/flowable-admin.war $DIRPATH/webapps
 ---> 5a79ea7d3522
Step 5/9 : COPY ./wars/flowable-idm.war $DIRPATH/webapps
 ---> 4aeb2dac4ad6
Step 6/9 : COPY ./wars/flowable-modeler.war $DIRPATH/webapps
 ---> 395a049722bb
Step 7/9 : COPY ./wars/flowable-task.war $DIRPATH/webapps
 ---> e61f4317b26f
Step 8/9 : EXPOSE 8080
 ---> Running in 78209cc2b1dd
Removing intermediate container 78209cc2b1dd
 ---> 5b87278c11d4
Step 9/9 : CMD ["", "run"]
 ---> Running in 633e2736b554
Removing intermediate container 633e2736b554
 ---> 042f08f229dc

Successfully built 042f08f229dc
Successfully tagged tomcat:8.0-jre8

In my case, I already had an image for mysql-db and adminer, so they were skipped. However, the Dockerfile was executed and an images was created with the name tomcat.

Now we just need to start the containers based on these images:

$ docker-compose up -d
Creating network "650_flowable-mysql" with the default driver
Creating volume "650_db_data" with default driver
Pulling mysql-db (mysql:5.7.26)...
5.7.26: Pulling from library/mysql
0a4690c5d889: Pull complete
98aa2fc6cbeb: Pull complete
0777e6eb0e6f: Pull complete
2464189c041c: Pull complete
b45df9dc827d: Pull complete
b42b00086160: Pull complete
bb93567627c7: Pull complete
48acc32b4863: Pull complete
6257d2da4815: Pull complete
1cd5ed3b2653: Pull complete
f4ba7ff24ae9: Pull complete
Digest: sha256:bdee7a98276ccf377d2c00b8ceaa9f65455a9376481467bbcc3d1e6b662dac5d
Status: Downloaded newer image for mysql:5.7.26
Pulling adminer (adminer:)...
latest: Pulling from library/adminer
cbdbe7a5bc2a: Already exists
1bc86e4cff5f: Pull complete
7be142bd33f5: Pull complete
8132c9e52be3: Pull complete
4751eedb34cf: Pull complete
d415e36b2fed: Pull complete
496b1da48343: Pull complete
c3bde6064779: Pull complete
666d5bf6e1bf: Pull complete
0a1f53fcd241: Pull complete
346a17777f39: Pull complete
5cc2b7995b6d: Pull complete
1a1faca69724: Pull complete
7102c95efcf2: Pull complete
0ad90c826104: Pull complete
Digest: sha256:1a5a60451570d8637f9fc794d9f1ef7ec1f3ed8cba0a9e45a6b6cb887837945b
Status: Downloaded newer image for adminer:latest
Creating flowable-mysql-mysql-5.7.26 ... done
Creating 650_adminer_1               ... done
Creating 650_tomcat_1                ... done

if you list the active container, you should be able to see something like this:

$ docker container ls -a
CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS                      PORTS                               NAMES
ccbbc356e207        tomcat:8.0-jre8                               " run"        35 seconds ago      Up 35 seconds     >8080/tcp              650_tomcat_1
b375bf990bb4        adminer                                       " docke…"   36 seconds ago      Up 35 seconds     >8080/tcp             650_adminer_1
dd61f326c79a        mysql:5.7.26                                  "docker-entrypoint.s…"   36 seconds ago      Up 35 seconds     >3306/tcp, 33060/tcp   flowable-mysql-mysql-5.7.26

To see the logs of the tomcat container, type the command docker logs -f CONTAINER_ID.

Let’s see the result

After a few moments, you should be able to access Tomcat’s home page (http://localhost:8080/).


Now, click on the button <Manager App>. It should prompt you for the credentials that we previously created.

Make sure that Flowable’s apps are up and running.

CANCHITO-DEV: Tomcat Manager App

If they are, you should be able to access Flowable’s apps by visiting the following URLs:

Remember that you will be prompted to log in by Flowable’s IDM. Enter admin as user and test as password.

Stopping the container

When you are done working with Flowable’s apps, you can stop and remove Docker containers, images, networks and volumes.

$ docker-compose down -v
Stopping 650_tomcat_1                ... done
Stopping 650_adminer_1               ... done
Stopping flowable-mysql-mysql-5.7.26 ... done
Removing 650_tomcat_1                ... done
Removing 650_adminer_1               ... done
Removing flowable-mysql-mysql-5.7.26 ... done
Removing network 650_flowable-mysql
Removing volume 650_db_data


In this post, we have shown how to deploy Flowable’s war files in a dockerized environment and using a MySQL database. We hope that, even though this was a very basic introduction, you understood how to use and configure them. We will try to go deeper into Flowable in upcoming posts.

Please feel free to contact us. We will gladly response to any doubt or question you might have.

If you like it, read our second part here.

About canchitodev

Professional with solid experience in software development and management, leadership, team-building, workflow design and technological development. I consider myself a proactive, creative problem-solver, results-driven and with exceptional interpersonal skills person, who likes challenges, working as part of a team, and in high demanding environments. In these last few years, my career has focused on software management, development and design in the Media Broadcasting for television stations, thus allowing the automation of workflows

5 1 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
4 years ago

[…] Tomcat environment and connecting to a container running MySQL. The main difference with the first part of this series, is that we will not modify the war files, instead, we will pass the database configuration […]