Set up EHRbase with Docker
In this lesson, we’ll walk through the process of setting up EHRbase using Docker. In the rest of this module, we will see how templates, compositions and EHRs are used in real-world healthcare systems based on openEHR.
What we’ll be doing is running our own local openEHR Server Instance using EHRbase which will allow us to work and play with the openEHR REST API.

Before we dive into the technical setup, let’s understand what EHRbase is and what it does.
What is EHRbase?
EHRbase is an open-source Clinical Data Repository that serves as a robust backend solution for storing patient records.
What makes it particularly valuable is that all stored records are:
- Versioned: tracking changes over time
- Auditable: maintaining a clear record of modifications
Built on openEHR principles, EHRbase uses archetypes and templates to ensure data consistency.
Prerequisites
Before we begin the setup, make sure you have the following tools installed on your system:
System Requirements:
- Operating System: Windows, Linux, or Mac
- Postman: A popular tool for testing APIs and making HTTP requests. We’ll use this to interact with EHRbase’s REST API
- Docker: A containerization platform that will help us run EHRbase and its database without complex manual setup
- Bash Terminal (Recommended): A command-line interface that makes working with Docker and other tools more straightforward
- Code Editor: VSCode or Cursor - Any modern code editor will work, but these are recommended for their excellent Docker integration
Setup process
While EHRbase’s documentation provides standard installation instructions for PostgresDB and EHRbase, we’ll take a slightly different approach. Our goal is to give you a deeper understanding of what happens behind the scenes, which will be invaluable as you work with the system.
We have created a Git Repository which you can clone to get started. In this repository, we have already configured the docker-compose file along with an SQL initialization script, which is the init.sql file.
To clone this repo, run the following command in any terminal of your choice
git clone https://github.com/medblocks/openehr-bootcamp
This will clone the project in the folder where your terminal is opened.
Note: Now depending on when you are seeing this tutorial there might be a recent version for the EHRbase image out there. You could just go to docker hub and check out the latest version as well.
The next step is to run the docker file.
docker-compose up
This will run the docker container and once it’s done, you can open http://localhost:8080/ehrbase and it should open the EHRbase Page and show its logo, as in the below screenshot.

You can also take a look at their Swagger UI Documentation at http://localhost:8080/ehrbase/swagger-ui.html. In this page, you can see all the available endpoints and APIs which are mostly based on the openEHR REST API:

What’s next?
Now that we have set up our own openEHR server instance locally with the help of EHRbase, we can move on to the next lesson where we will get started with the openEHR Template API.
