Running Camunda with MySQL in Docker Container
In this article, we'll run a Camunda bpm platform connecting to MySQL Database in the Docker container. We'll use the MySQL client to verify the Camunda database.
Join the DZone community and get the full member experience.
Join For FreeIn this article, we are going to run a Camunda bpm platform connecting to MySQL Database within the Docker container. At the same time, we'll use the MySQL client (workbench) to verify the Camunda database (Although the same can be done by Docker CLI for MySQL as well).
Below is the list of packages that you need to add before proceeding:
a) Download and install Docker-desktop
b) Download and install MySQL workbench (Optional, To verify the installation of MySQL in docker)
STEP-1: Running MySQL in Docker container
Run the below command in command prompt to run MySQL in Docker Container with name "mysql".
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysqladmin -d mysql/mysql-server:latest
Note: Set up your own password for MySQL instead of mysqladmin in the above command.
Open the Docker desktop app and verify MYSQL is running on the docker container.
STEP-2: Connecting MySQL Workbench with Docker container
a) Open CLI command prompt of mysql as highlighted.
b) Enter command mysql -u root -p press enter and enter the password as mysqladmin (OR as given in step-1). You will be connected to mysql console.
Note: On this console, also we can validate the Camunda database later using mysql commands hence steps 2-c, 2-d and 2-e are completely optional.
c) To connect MySQL with the workbench need to execute the below command on the MySQL console.
update mysql.user set host = '%' where user='root';
d) Open MySQL workbench and enter the details as below. Use password as provided in step-1.
e) Connect to MySQL Database.
f) Create a new schema in MySQL say named "mydb" using the below command.
create database mydb;
g) Verify the database is created and having no tables.
Step-3: Running Camunda BPM
a) Open command prompt and execute the below command to start Camunda in docker container name as "camunda-mysql-env ".
docker run -d --name camunda-mysql-env -p 8080:8080 --link mysql:db -e DB_DRIVER=com.mysql.cj.jdbc.Driver -e DB_URL=jdbc:mysql://db:3306/mydb?autoReconnect=true -e DB_USERNAME=root -e DB_PASSWORD=mysqladmin -e WAIT_FOR=db:3306 camunda/camunda-bpm-platform:latest
b) Refresh the database and check for Camunda tables are created inside "mydb" database. The same can be verified in Docker CLI (for MySQL) also.
The same can be verified using CLI as well.
c) Open the browser and check if the Camunda application is running at http://localhost:8080/camunda/.
Thanks for reading!!!
Opinions expressed by DZone contributors are their own.
Comments