Running Camunda With Postgres Using Docker
This tutorial explains how to connect the Camunda BPM platform to the Postgres Database using Docker in just four total steps.
Join the DZone community and get the full member experience.
Join For FreeIntroduction
Let's connect the Camunda BPM platform to Postgres Database using Docker. Below are the packages which are used in this article.
- Docker Desktop for Windows (download Docker-desktop)
- pgAdmin v4 (Download link)
Step 1:
Install Docker-desktop and pgAdmin downloaded as above.
Step 2:
Running Postgres in Docker container:
a) Open command prompt and execute the below command to run the Postgres in a docker container named "Postgres."
docker run --name postgres -e POSTGRES_PASSWORD=postgres-password -d postgres
Note: Choose a password for the Postgres database.
Open the docker-desktop to see a container with the name "Postgres" is running.
Step 3:
Running Camunda in Docker container:
Below are the 2 steps given to run a Camunda in a docker container. a) Supplying DB credentials as command line arguments b) Supplying DB credentials using a text file.
a) Open command prompt and execute the below command to run the Camunda in a docker container named "Camunda-postgres-env."
docker run -d --name Camunda-postgres-env -p 8080:8080 --link postgres:db -e DB_DRIVER=org.postgresql.Driver -e DB_URL=jdbc:postgresql://db:5432/postgres -e DB_USERNAME=postgres -e DB_PASSWORD=postgres-password -e WAIT_FOR=db:5432 Camunda/Camunda-bpm-platform:latest
b) Alternate way to pass DB details to run Camunda. Save the below properties in a file named as say, "dev-env.txt."
DB_DRIVER=org.postgresql.Driver
DB_URL=jdbc:postgresql://db:5432/postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres-password
WAIT_FOR=db:5432
And, execute the below command to run the Camunda in a docker container named "Camunda-postgres-env-file."
docker run -d --name Camunda-postgres-env-file -p 8080:8080 --link postgres:db --env-file dev-env.txt Camunda/Camunda-bpm-platform:latest
Note: Update Postgres database password in the above command.
Verify in the docker-desktop app for the running Camunda.
Step 4:
Connecting to Postgres database to verify the connection and Camunda database/ tables.
a) Open pgAdmin application and enter the connection details as below:
b) Save the details and verify in tables where Camunda tables are in place.
Step 5:
Open the browser and type in the URL to see Camunda app running.
Hope this helps!
Opinions expressed by DZone contributors are their own.
Comments