Running HAPI FHIR with the hapiproject/hapi Docker image

The hapiproject/hapi image is the fastest way to start a HAPI FHIR JPA server. This page covers configuration, tag choice, version pinning and what to confirm before production.

On this page

Running HAPI FHIR with the hapiproject/hapi Docker image: when teams use it

A team that needs a self-hosted FHIR server in its own infrastructure and wants a container starting point should use the published hapiproject/hapi image, which runs the HAPI FHIR JPA server starter. The starter is a RESTful FHIR server backed by a database, using the JPA API rather than a specific database technology. Its documentation covers FHIR DSTU2, DSTU3, R4, R4B and R5, along with terminology services, validation, MDM and partitioning, so the image is a complete server rather than a sample app. The image is one of several ways to run the starter: the same codebase can also be deployed with Docker Compose, with Spring Boot, as a WAR on Tomcat, Jetty or Wildfly, or on Kubernetes with the Helm chart. Teams that already run an application server or a Kubernetes platform should weigh those routes against the image before committing.

The image suits teams that want the server running quickly in a single container host, a test environment or a Compose stack that they will extend. Its configuration comes from environment variables or a mounted application.yaml, so the same image can move between environments with different settings. The starter defaults to an embedded H2 database, which is not a production choice. Before you build on the image, confirm which database you will use: PostgreSQL and Microsoft SQL Server are supported for production, and MySQL is not. Also confirm the FHIR version and enabled modules you need, because those settings shape the schema and the features you can test later.

The image does not give you security, audit or hardening by default. HAPI FHIR provides building blocks such as authentication interceptors, the AuthorizationInterceptor, consent and search narrowing interceptors, CORS support and BALP audit logging, but it does not supply a single security layer. Decide early which of these your organization requires, who owns the identity provider and how the container is patched. The image tag you deploy is part of that patch process, so plan to pin a specific version and confirm the Java requirement for it: HAPI FHIR 8.2.0 requires JDK 17, and the current release line is documented in the versions page.

How the container, configuration and database fit together

The flow starts with a client request arriving at the reverse proxy, which terminates TLS and forwards traffic to the hapiproject/hapi container. Inside the container, the JPA server reads its settings from environment variables or a mounted application.yaml, then reads and writes FHIR resources through the JPA layer to an external PostgreSQL or SQL Server database. The key hand-off to check is the database connection: the starter defaults to an embedded H2 database, so production settings must point it at an external database. The dashed boundary marks where the client network ends and the server network begins.

Request path, startup configuration and external database for the HAPI FHIR container.

Which image tag and configuration method fits which situation

This table compares the image tag families, configuration methods and database choices for the HAPI FHIR JPA starter image. Read each row as a decision: the situation it fits, then what it costs your team to debug, rebuild and maintain. Confirm exact tag names in the project repository before you pin anything.

DecisionWhen it fitsOperations cost
Distroless tag familyProduction teams that want a minimal runtime with no shell, and who can inspect the container from outside itDebugging inside the container is harder without a shell, so plan log and metric access up front. Confirm the exact tag name in the hapi-fhir-jpaserver-starter repository.
Tomcat tag familyTeams that need a shell in the container for troubleshooting, or that already run Tomcat-based tooling and standard file layoutsA larger runtime to scan and patch, and more moving parts to review. Confirm the exact tag name in the project repository.
Environment variable overridesA small set of settings such as database URL, credentials and server address, injected by Docker Compose or Kubernetes secretsEasy to change per environment, but long lists of variables become hard to review and audit. Keep a written record of every override.
Mounted application.yamlMany settings, enabled modules, or configuration that a reviewer should read as one file under version controlEach change means editing and redeploying a file, and you must manage the file's location, permissions and drift between environments.
Embedded H2 defaultLocal evaluation, demos and short-lived test environments where data loss is acceptableData lives inside the container. Restarts without a volume lose it, and H2 is not a production database for this server.
PostgreSQLProduction deployments that need a supported database with backups, replication and familiar operations toolingYou run the database itself: provisioning, sizing, backups, upgrades and connection limits sit with your team or a database partner.
Microsoft SQL ServerOrganizations whose standard database platform is SQL Server and whose DBAs will operate itLicensing, DBA ownership and version alignment must be agreed up front. Confirm the supported configuration in the starter documentation.
MySQLNot a supported option for the JPA server starterChoosing it means building and testing an unsupported path, which you would own alone during upgrades.

Starting the image and checking it is ready

This sequence takes the published HAPI FHIR JPA server image from a pinned version to a running instance with a production database, a public address and a verified capability statement. Your platform team should run it in a non-production environment first, and each step ends with a check you can record.

  1. Confirm the release and Java requirement

    Check the HAPI FHIR versions page and the releases on GitHub before you choose a tag. At the time of writing, the latest published release was v8.8.2, released 25 September 2026, but newer releases may exist, so confirm the current version on the day you pin it. If you build the starter locally, the JDK matters. HAPI FHIR 8.2.0 requires JDK 17, so check the requirement for the exact release you select. Done when you have written down one version and its Java requirement.

  2. Pull a pinned image tag

    Pull the hapiproject/hapi image using a specific version tag so every environment runs the same build. Avoid floating tags such as latest. Choose the base variant that fits your environment, such as a distroless or Tomcat tag, after confirming which tags the image repository currently publishes. Record the image digest with the tag if your registry supports it. Done when the pull completes and docker image inspect shows the tag you wrote down.

  3. Choose environment variables or a mounted file

    Decide how configuration reaches the container. Environment variables suit a small set of overrides, while a mounted application.yaml keeps layered settings in one reviewed file. Keep the file in version control and mount it read-only at the path the starter reads. Inject secrets such as database passwords from your secrets store at runtime. Done when the container starts with your configuration applied and the logs show the FHIR version and modules you intended.

  4. Point the server at a production database

    Replace the embedded H2 default with PostgreSQL or Microsoft SQL Server, the production databases the starter supports. MySQL is not supported by the starter. Create the database and a dedicated account with rights to the schema the server manages, and provide the connection settings through the configuration you chose in the previous step. Done when startup logs name your database engine and show a successful connection with no H2 connection in use.

  5. Set the public server address

    Set the public base address that clients use to reach the server, including scheme, host and FHIR path. Links and Bundle entries are built from this value, so behind a load balancer or reverse proxy it must match the external URL the proxy exposes. Confirm the setting name in the configuration reference for your release. Done when a search response returns links that use the public host and path, not the internal container address.

  6. Start the container and read the startup log

    Run the container with the port, volume and environment mappings your platform needs, then follow the logs until the server reports that startup has finished. The first start against an empty database can take longer because the schema is created, so allow for that before deciding the container has failed. Stop and fix any configuration error the log names. Done when the container stays running and the logs show startup completed without errors.

  7. Verify the capability statement and a sample read

    Request the capability statement from the metadata endpoint under your public FHIR base URL. Check that the FHIR version matches the release you planned and that the resource types you expect are listed. Then read a synthetic test resource you loaded for this check. HAPI FHIR does not provide a single security layer, so add authentication and authorization before any real data arrives. Done when the metadata request returns a successful response and the read returns the resource you loaded.

Why pinning the image version matters for production

Pin the hapiproject/hapi image to an exact release tag in production, and never deploy a floating tag such as latest. A floating tag changes what runs without a change in your repository, so a routine pull or node restart can move the server to a newer HAPI FHIR release with a different JPA schema, different Java requirements and different defaults. The upgrade then happens unplanned, usually in the middle of a maintenance window nobody scheduled. A pinned tag makes the image a reviewed input: the version changes only when someone edits the manifest, runs the upgrade steps and records the result. Before choosing a tag, check the release notes and the HAPI FHIR versions page, which lists the Java requirement for each release, including the JDK 17 requirement that applies to HAPI FHIR 8.2.0.

A pinned version also ties the container to a database state. The JPA server creates and migrates its schema for the release it runs, so an image that starts against a database last used by a newer or older release can fail at startup or, worse, run against a schema it does not expect. Confirm the migration path for your target version in the upgrade documentation before you change the tag, and take a database backup first. Keep the Java base in mind as well, because a tag that moves the JDK requirement can conflict with the runtime you expect on your hosts or with a custom interceptor JAR built against an older JDK.

Store three things together in version control: the exact image tag, the application.yaml or environment variable set that configures it, and a record of the database schema state (the release that last migrated it and the date of the change). A single commit should show that the tag, the configuration and the expected schema move together. Reviewers then see the full change, rollback means reverting one commit and restoring the matching database backup, and an auditor can trace which version handled which data. Also confirm whether your chosen tag uses the distroless or Tomcat variant, since switching variants is a change to review in the same way.

What the container does not secure for you

The hapiproject/hapi image starts a working FHIR server, but it does not decide who may read or write data, how secrets are protected, or what gets logged. HAPI FHIR documents building blocks for those jobs, and the operator must assemble and verify them before any real patient data arrives.

Security building blocks, not a security layer

HAPI FHIR offers authentication interceptors, the AuthorizationInterceptor, consent and search narrowing interceptors, CORS support and BALP audit logging, but it does not provide one finished security layer. Each of these must be chosen, configured and tested for your identity provider and access rules. Confirm which interceptors your deployment enables by reviewing the mounted configuration, not the defaults you assume.

HAPI FHIR security docs

Secrets passed as environment variables

Database passwords, OAuth client secrets and similar values reach the container as environment variables, which are visible to anyone who can inspect the container definition or run docker inspect. Use your platform's secret store or Docker secrets where possible, restrict who can read container metadata, and rotate credentials on a schedule you document. Confirm that no secret ends up in an image layer or a committed Compose file.

Database credentials and network path

The starter defaults to an embedded H2 database, so production use means pointing it at PostgreSQL or Microsoft SQL Server with a dedicated account. That account should hold only the rights the server needs, and the database should accept connections only from the server's network segment. Check that the default embedded database is not left active by accident after a configuration change.

TLS termination at the proxy

The container serves plain HTTP inside your network, so TLS is normally terminated at a reverse proxy, load balancer or ingress. Confirm that the public base address the server advertises uses https, that certificates renew automatically, and that traffic between the proxy and the container is either trusted by policy or encrypted. An unterminated or misconfigured hop exposes patient data in transit.

Actuator endpoints exposed beyond the cluster

Health and metrics endpoints served through the actuator can reveal internal state, versions and component details. Do not route them through the public ingress, and restrict them to the monitoring network or your probe configuration. Ask your team to list every exposed endpoint and confirm that each one is either needed or disabled.

Audit logging enabled before go-live

BALP audit logging is a building block that the operator must switch on and verify, so that reads, writes and access decisions leave a record. Test it with a known user action, confirm the entries reach a store your security team can query, and set a retention period that matches your policy. Turning it on after launch leaves a gap in the record that cannot be recovered.

Questions teams ask before running the image

What does it cost in effort to run the HAPI FHIR Docker image?

The image itself is free to pull, so the cost is the people time to start it, configure it, connect it to a database and keep it running. Effort splits into one-time work (environment setup, database provisioning, configuration review, security controls, testing and cutover) and recurring work (patching, image pinning, upgrades, backups and monitoring). The main drivers are how many environments you run, whether you need custom interceptors or implementation guides, and how much of the security and audit layer you must build yourself, since HAPI FHIR provides building blocks rather than a complete security layer. Ask any partner for a quote that lists these items separately, and check whether it covers ongoing upgrades.

How long does a first working deployment take?

The duration depends less on the container start and more on the surrounding decisions: choosing the database, wiring TLS and the public server address, deciding how users authenticate, and validating that resources and searches behave as your applications expect. A team with container and database experience can get a test instance responding quickly, while a production-grade setup with identity integration, audit logging, backups and monitoring takes considerably longer. Each open decision, such as an unfamiliar database or a missing identity provider, adds time. Confirm your timeline against a written scope rather than against the first successful startup.

What must our team provide before the deployment starts?

Plan to supply several dependencies before the container runs in a meaningful way:

  • A PostgreSQL or Microsoft SQL Server database, since the starter defaults to embedded H2 and does not support MySQL for production
  • TLS certificates for the public hostname, and a DNS record that points to the load balancer or ingress
  • An identity provider and the access rules that will map to FHIR resources, if clients must authenticate
  • A container runtime or orchestrator, storage for database volumes, and a secrets store for credentials

Ask your team to confirm each item in your own environment, because the choice of database and identity provider changes the configuration work.

Can a team deploy the image alone using the documentation?

Yes, a team with Docker, Java and database experience can usually run the image from the public documentation and the starter repository, and a proof-of-concept environment is a reasonable place to learn. The harder part is operating it: understanding which settings to review before go-live, how the schema is handled, and which access, audit and consent controls must be built around the server. Teams without FHIR or healthcare security experience often find the gaps are in validation, authorization and audit rather than in the container. Decide early which of these you will own and which you will hand to a partner.

How are upgrades handled for the image?

Upgrades depend on pinning a specific image tag, testing the new version against a copy of your data and configuration, and then rolling it out. Pin the version in your deployment files rather than relying on a floating tag, because an unplanned pull can change behavior. HAPI FHIR 8.2.0 requires JDK 17, and the latest release supplied in our research is v8.8.2, released on 25 September 2026, so check the version notes for each step on your path. Schema migrations and breaking changes should be reviewed before any production rollout, and backups should be verified before the change.

When is outside help worth paying for?

Outside help makes most sense when the deployment carries regulatory weight, uses a database or identity provider your team has not operated, or needs custom interceptors, implementation guides or security testing before go-live. It is also worth considering when the internal team lacks time for upgrades and monitoring. DeployOpen plans, implements, hardens, backs up, upgrades, documents and supports self-hosted open-source platforms inside your own infrastructure, and most engagements are fixed-scope with agreed deliverables and timelines. DeployOpen does not publish a price list, and a quote follows from a written scope that you can compare with your own estimate. Support and upgrades can also be arranged as a retainer.

Does the image handle security and compliance for us?

No. HAPI FHIR does not provide a single security layer that makes a deployment compliant on its own. It offers building blocks such as authentication interceptors, the AuthorizationInterceptor, consent and search narrowing interceptors, CORS support and BALP audit logging, and your team must choose, configure and test them. Compliance readiness means documenting the controls, retaining evidence and having independent auditors or certification bodies assess the result, since DeployOpen prepares systems and evidence but does not issue audit reports or certifications. Plan this work alongside the deployment, not after it.

Where a container start stops and a production build begins

A running hapiproject/hapi container proves that the JPA server starts and answers requests. It does not prove the server is ready for patient data. The gap between the two is mostly operational: a production build needs a database sized and backed up for the expected volume, a public address that matches what clients actually call, monitoring that alerts before users notice trouble, and a tested path to the next release. The embedded H2 database is the default, and the starter supports PostgreSQL and Microsoft SQL Server for production, so the first decision is to move off H2 and confirm the database engine your organization will support, sized and backed up under your own recovery targets. Ask who owns the database, who restores it, and how long a restore has been rehearsed.

The public address is the next gap. The server builds links and Bundle entries from its configured base URL, so a container that runs correctly on an internal port can still return links pointing at an address clients cannot reach. Confirm the external hostname, TLS termination point and the reverse proxy or load balancer configuration before go-live, and test a search and a read through the same path your applications will use. Monitoring and upgrade rehearsal belong in the same review. Decide which metrics, logs and health signals you collect, who receives alerts, and whether you restore a copy of production data into a staging environment and run the target image version against it before any production change. Confirm the release notes and schema changes for the version you plan to adopt, and check the Java requirement for it in the HAPI FHIR versions documentation.

Security is the largest gap. HAPI FHIR does not provide one complete security layer. It offers building blocks such as authentication interceptors, the AuthorizationInterceptor, consent and search narrowing interceptors, CORS support and BALP audit logging, and the operator must decide how these fit the access model, identity provider and audit obligations of the organization. Expect to design authentication, resource-level authorization, audit trails and any partitioning or data separation before the server is exposed to users. Treat the container's default configuration as a starting point to review, not a finished posture. The production readiness checklist sibling topic in this group lists the items the starter leaves to the operator and is the natural next read.

How DeployOpen scopes and delivers a HAPI FHIR container deployment

DeployOpen plans and runs the hapiproject/hapi container deployment inside your own infrastructure, from image tag selection and configuration through to a documented, handed-over server. Each engagement starts with a written scope that sets out which configuration, database, identity and operational decisions are in and out of the work.

How we scope

  • We confirm the target runtime, whether Tomcat or distroless tags suit your hosts, and the pinned image version you will run.
  • We record the database choice, which must be PostgreSQL or Microsoft SQL Server for production rather than the embedded H2 default.
  • We agree in writing which security building blocks, audit logging and reverse proxy work are included, since the starter leaves these to the operator.

How we build

  • We deliver the container configuration through environment variables or a mounted application.yaml, kept under version control with secrets held outside the image.
  • We test startup against your chosen database, including schema creation, persistent storage and the FHIR version and modules you have enabled.
  • We verify the server's base URL, FHIR endpoints and health behavior from the networks where clients will reach it before any handover.

How we hand over

  • We provide the pinned image reference, configuration files and a runbook covering how to change, roll back and upgrade the image tag.
  • We document the configuration keys set for your environment so your team can review them against your own security and compliance requirements.
  • We walk your platform and operations staff through startup, logs, and the checks they will run after each change.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, which can cover image tag updates as new releases are published.
  • Before go-live, confirm with DeployOpen and your own teams who owns each upgrade decision, backup routine and access review after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.