Running Hyperledger Besu in Docker for production

Production Besu containers need persistent data volumes, correct bind-mount permissions for genesis and permissions files, restart handling after OutOfMemoryError exits, and a backup before every image upgrade.

On this page

Running Hyperledger Besu in Docker for production: what your team must get right

A platform team moving a permissioned Besu node from a test container to a production host should treat four things as non-negotiable: a persistent data volume that survives container replacement, bind mounts that correctly supply the genesis and permissions files, a restart policy that brings the node back after an out-of-memory exit, and a full backup taken before every image upgrade. Besu is an open source Ethereum execution client written in Java and licensed under Apache 2.0, and it is a Graduated project of LF Decentralized Trust, so the Docker image is one of several supported ways to run it alongside package installs and Kubernetes. The choice of packaging does not change these four requirements; it only changes where they are configured.

Start with the data volume. The node's ledger lives in the data directory, so that directory must sit on a named volume or host path that is independent of the container's lifecycle. Confirm that the same volume is reattached on every start, that its file ownership matches the user the container runs as, and that the host has enough free space for ledger growth. The genesis file and the local permissioning files are read from the container, so each should be supplied through a bind mount rather than baked into an image. Note that the --permissions-accounts-config-file and --permissions-nodes-config-file options are not used with the Docker image; the permissions file is supplied by a bind mount instead, as described in the Besu local permissioning documentation. Check mount paths and permissions in a staging run before go-live, because a missing or unreadable file is a common cause of a node that fails to start.

Set the restart policy and the memory limits as one decision. Besu 26.9.0 exits on OutOfMemoryError, and the release notes advise either a restart policy or setting JAVA_OPTS=-XX:-ExitOnOutOfMemoryError to opt out, so your team must choose deliberately and test the result. Restart-on-failure is the safer default for a validator or bootnode, but a crash loop caused by undersized memory will hide the real problem, so alert on repeated restarts. Before each image upgrade, take a backup of the data directory and record the current image tag. The 26.10.0 release notes state that the Bonsai database auto-upgrades on first start and that older versions cannot open an upgraded database, so the backup is the only rollback path. Confirm with your network operators how and when that backup is verified.

Setting up a Besu container for production, step by step

This sequence takes a Besu node from a bare Docker host to a container that keeps its data, reads its genesis and permissions files, restarts after failure and exposes metrics. Each step ends with a check you can run before moving on.

  1. Pin the Besu image to a release tag

    Choose a specific hyperledger/besu tag from the Besu releases list on GitHub instead of latest, and record it in your deployment configuration under source control. Confirm the release notes for that version match your network's consensus and feature needs, and note that Besu 26.6.0 and later require JDK 25 for builds, so check the image base if you build your own. Pulling the tag once and running docker image inspect on it shows the exact image you will operate. Keep the same tag in staging so that you test the image you will run in production.

  2. Create the host directory with correct ownership

    Create a dedicated host directory for node data, such as one for the chain database and keys, and set its owner and permissions so the user the Besu process runs as can write to it. Confirm the UID and GID the image runs as before you set ownership, because a mismatch is a common cause of startup failures. Keep this directory on storage you have sized for chain growth and back it up on a schedule you define. The check is a test write from inside a throwaway container running with the same user and mount.

  3. Bind mount the genesis file

    Place the genesis file for your network on the host, read-only, and mount it into the container at a fixed path that you pass to Besu. Use the same genesis file on every node of the network, and store a checksum of it so that a changed file is detected before a restart. Confirm the node starts against the expected chain ID and genesis hash in its first log lines. If the genesis hash differs from the other nodes, stop and correct the mount before the node joins the network.

  4. Bind mount the local permissions files

    Because the --permissions-accounts-config-file and --permissions-nodes-config-file options are not used with the Besu Docker image, supply both permissions files by bind mounting them from the host into the container path that your Besu configuration expects. Keep the files under source control and mount them read-only so that the running node cannot change its own rules. Confirm the files are read by checking the startup logs for permissioning messages and by testing that a connection from a node outside the allowlist is refused. Confirm the exact file paths and option names against the local permissioning documentation for your Besu version.

  5. Set the restart policy and OOM behavior

    Set a restart policy on the container, such as unless-stopped or on-failure, so Docker starts Besu again after a crash or after the host reboots. Besu 26.9.0 exits on OutOfMemoryError, and the release notes advise a restart policy or setting JAVA_OPTS=-XX:-ExitOnOutOfMemoryError to opt out. Choose one approach deliberately and document it, because an unrestarted node that stays running in a bad memory state can be harder to diagnose than one that exits. The check is a controlled stop of the container followed by confirmation that it returns to running with the same data and peer connections.

  6. Enable Prometheus metrics

    Turn on metrics with the --metrics-enabled option and expose the metrics port, which defaults to 9545, to your Prometheus server only, not to the public network. Map the port in the container configuration and restrict it at the host or network level. Confirm the endpoint responds from the monitoring host and that Prometheus shows the Besu target as up. Metrics collection gives you the baseline you need before any upgrade, so do not skip this step on a node that holds validator or signing responsibility.

  7. Confirm the node restarts with the same data

    Stop the container cleanly, start it again with the same volume and configuration, and confirm the node resumes from its stored block height rather than resyncing from the beginning. Check that peer connections return and that the permissions files are still applied after the restart. Repeat the test after a forced kill to confirm the node recovers from an unclean stop. Record the block height before and after each test, since a node that resyncs unexpectedly points to a volume or path problem.

  8. Document the image upgrade path before go-live

    Write down the upgrade procedure for this node before it goes live: pull the new hyperledger/besu image, stop the container, and start it again with the same data, as the Besu upgrade guide for Docker describes. Note that the Bonsai database auto-upgrades on first start and older Besu versions cannot open an upgraded database, so take a backup of the data volume before any upgrade and keep the previous tag available for rollback. Test the procedure on a non-production node first, and confirm the rollback path by restoring that backup. Keep this runbook with the deployment configuration so that operators follow the same steps each time.

Docker settings for data, mounts, memory and restarts

The Besu container writes chain data, the database and the node key to a data directory inside the container. If that directory is not backed by a named volume or a host bind mount, the data is lost when the container is removed, and a fresh node must resync from peers. For production, the data path should sit on storage you can size, snapshot and back up, and it should survive image upgrades and container recreation.

  • Persistent location: Mount a named volume or a host directory to the data path used by the image, so stopping or replacing the container keeps the ledger.
  • Storage class and size: Ask your platform team how fast the volume grows on your network and whether it can be expanded later without a rebuild.
  • Ownership: Confirm the UID that the Besu process runs as can write to the host directory, since a mismatch is a common cause of startup failures.
  • Backups: Plan a backup taken while the node is stopped or from a consistent snapshot, because the Bonsai database upgrades itself on first start.
  • Node key: The node private key lives in the data directory and is not encrypted by default, so decide who can read that path.

Before go-live, confirm the volume survives docker rm of the container in a test run and that a restore from backup starts a node with the expected identity.

How the host, container and mounted files fit together

The diagram starts on the host, where a data directory, a genesis file and permissions files live outside the container. Bind mounts carry the data directory in for read-write use and the genesis and permissions files in read-only, so the container reads configuration but cannot change it. Besu exposes JSON-RPC and P2P ports to the network, a metrics endpoint that Prometheus scrapes, and a restart policy that brings the container back after an exit. Check that the trust boundary sits where you expect, that the permissions files are mounted and not passed as flags, and that the metrics port is reachable only from your monitoring network.

Host files, mounts, ports and restart supervision around one Besu container.

Upgrading the image without losing node state

The Besu upgrade path in Docker is short: pull the new image, stop the container, and start it again on the same data. The risk sits in the data itself, because a newer release can change the database format in a way older versions cannot read. The cards below cover the steps in the order a careful operator runs them, ending with the decision to roll back.

Back up the data before upgrading

Take a backup of the data volume before you change anything. For Besu 26.10.0 and later, the Bonsai database upgrades itself on first start, and older Besu versions cannot open the upgraded database. A backup is therefore the only rollback path. Confirm that the backup is complete, readable and stored outside the host that runs the node, and time a test restore if you have not done one before.

Besu upgrade guide

Pin the image tag

Reference an exact hyperledger/besu version tag in your compose file or orchestration config instead of latest. A pinned tag means the node changes only when you decide it should, and the version you tested is the version that runs in production. Record the tag in your change ticket so the rollback target is unambiguous later.

Test the upgrade in staging

Run the target image against a copy of the production data in a non-production environment before you touch the live node. Check that the node starts, syncs to the chain head, and serves the JSON-RPC methods your applications call. Keep the staging test separate from the production change window so that a failure does not cost you the production node.

Stop, pull and start the container

Pull the new image, stop the running container, and start a new container with the same data volume and the same configuration mounts. Do not delete the volume, and do not change the data path between versions. Watch the first start in the logs, because the database migration runs at that point and a failure there is the moment the backup becomes necessary.

Check the node after startup

Confirm that the node reaches the expected block height, has peers, and produces or imports blocks in line with the rest of the network. Check the metrics endpoint and the logs for errors during the database upgrade. Compare the node's chain head with other validators before you consider the change finished.

Decide on rollback quickly

Set a rollback threshold before the window opens, such as a node that will not sync or fails its health checks after the defined waiting period. If you roll back, stop the upgraded container, restore the backup taken before the upgrade, and start the older pinned image. Record the decision and the reason, since a restored node must be reviewed before it rejoins the network.

Restart policies after OutOfMemoryError exits in Besu 26.9.0

Besu 26.9.0 exits when it hits an OutOfMemoryError, so a container that has no restart policy stays down until someone starts it by hand. For a validator or a node that serves RPC traffic, that means missed blocks or an unavailable endpoint for as long as the on-call process takes to notice. Before you deploy 26.9.0 or later, set a restart policy on every Besu container, such as unless-stopped or on-failure in Docker Compose, or the equivalent restart setting in your orchestrator. Then confirm the policy works by forcing a test exit in a non-production environment and checking that the container returns with its data volume intact.

The release notes give two options. The first is to keep the restart policy, which lets the node recover from a clean process exit. The second is to opt out of the exit by setting JAVA_OPTS=-XX:-ExitOnOutOfMemoryError, which tells the JVM to keep running after an out-of-memory condition. Opting out is not a fix for memory pressure. The process may continue in a degraded or inconsistent state, and the failure you wanted to see early may show up later as stalled sync, dropped peers or corrupted work in progress. Choose it only if you have sized the container memory limit and the JVM heap with headroom, and you have alerting on memory use and on Besu health that would catch a node that is alive but not making progress.

Make the decision in your change record, not in the image definition alone. Ask your Besu release owner which option the network's operating procedure assumes, and confirm the restart behavior with your container runtime and orchestrator, since their restart semantics differ. Keep the memory limit, heap setting and alert thresholds under source control next to the restart policy so that a future image upgrade does not silently change the failure behavior. The Besu GitHub releases page is the place to check whether later releases change this behavior.

Security and operational considerations for containerized nodes

A containerized Besu node holds a private key, exposes a JSON-RPC API and depends on the container runtime to protect both. The cards below cover the decisions that sit between the image and the network: where the node key lives, who can call the API, and what terminates encryption in front of it.

Protect the node private key file

The local node private key file is not encrypted by Besu. Anyone who can read the mounted file can impersonate the node on the peer network. Mount the key from a host path or secret with owner-only read permissions, make sure the container user can read it, and confirm the file never lands in an image layer, a shared volume or a backup that others can open. Check the key's permissions after every volume change.

Besu node keys docs

Use a security module for hardware-backed keys

Where policy requires hardware-backed key storage, run Besu with a security module plugin such as the Besu HSM plugin and the --security-module option instead of a plain key file. Ask the team that owns the HSM how signing is authorized, how the module is reached from the container network, and what happens to block production when the HSM is unavailable. Test a node restart against the HSM before go-live.

Authenticate JSON-RPC requests

Besu can require authentication on its JSON-RPC API with a username and password credentials file or with JWTs signed by an external issuer and validated against a public key. Choose one method per deployment, decide which RPC namespaces are exposed and to whom, and confirm which clients (wallets, back-end services, operators) hold credentials. Keep credentials files out of the image and rotate them when staff or services change.

Besu authentication docs

Terminate HTTPS outside Besu

Besu does not terminate HTTPS natively, so the JSON-RPC endpoint is served over plain HTTP inside the container network. Place a reverse proxy or equivalent gateway in front of it to handle TLS certificates, cipher policy and client access logging, and bind Besu's HTTP port only to the internal network. Verify that no path from outside the cluster or host reaches the unencrypted port directly.

Limit container memory and restart behavior

Besu 26.9.0 exits on OutOfMemoryError, so a container without a restart policy stays down after a memory event. Choose a restart policy deliberately, and check whether the exit should be treated as an alert rather than hidden by automatic restarts. Setting JAVA_OPTS=-XX:-ExitOnOutOfMemoryError opts out of the exit, which keeps the process alive in a degraded state, so test that choice under load before using it.

Limits to confirm in your environment

Does my Docker or Compose setup actually honor the restart policy I choose?

Confirm it with a test rather than assuming it. Besu 26.9.0 exits on OutOfMemoryError, so the container runtime must restart it for the node to come back. Start the container with your chosen restart policy, force an out-of-memory condition in a non-production environment, and check that the container restarts and rejoins the network. If you run Compose, Swarm or an orchestrator, check how each one interprets the policy, because some platforms apply their own health and restart rules on top of Docker's. The release notes also describe opting out with JAVA_OPTS=-XX:-ExitOnOutOfMemoryError. Decide which behavior you want before you go to production, and document it in your runbook so operators know what a restart means for the node.

Are the container memory limit and JVM heap settings right for my node role?

The container memory limit and the JVM heap must be sized together, and the right values depend on the node role and the state you expect it to hold. A container limit set too close to the heap size can trigger out-of-memory exits under load, while a limit set too high can hide problems until the host runs short. Confirm the heap settings against the Besu documentation for the version you run, then load-test a validator-style node and an RPC-facing node separately, since their memory profiles differ. Record the observed peak usage and set alerts below the limit. Ask your platform team whether the orchestrator enforces the limit as a hard cap, and how it reports a container killed for memory.

Do I need JDK 25 for a custom Besu image build?

Yes, if you build Besu yourself. The Besu 26.6.0 release notes state that Besu requires JDK 25 to build and run. If you use the published hyperledger/besu image, the runtime is included, but any custom image, base image change or local build must use JDK 25 or later as the notes require. Check the release notes for the exact version you deploy, because a base image update in your own pipeline can silently change the Java runtime. Pin the base image digest, record the JDK version in your build output, and test the custom image on a non-production node before promoting it.

Which filesystem ownership rules apply to the data volume on my host?

The user inside the container must be able to write to the data directory, and the host must allow that. Confirm the UID and GID the Besu image runs as, then check that the bind mount or named volume on your host has matching ownership and permissions. Mismatched ownership is a common cause of startup failures that look like configuration errors. Also confirm your host OS policies, such as SELinux labels or AppArmor profiles, which can block writes even when Unix permissions look correct. Test a restart after changing ownership, because a node that starts once may still fail after a reboot or a host migration.

Will my release channel follow Besu's monthly calendar versions?

Confirm this with your own release process, because Besu ships roughly monthly and uses calendar version numbers. The GitHub releases page lists 26.7.0, 26.8.0, 26.9.0 and 26.10.0 in recent months, so a channel that tracks latest will move quickly. Decide whether you follow every release, a fixed cadence, or only releases that your validation has passed. Remember that some releases remove features, such as Clique consensus in 26.4.0, so read the notes before each step. Ask whether your change process can test and approve a new image within the window you plan to allow.

Can I roll back an image upgrade if the database has already been upgraded?

Only if you took a backup before the upgrade. The Besu 26.10.0 release notes state that the Bonsai database auto-upgrades on first start and that older versions cannot open an upgraded database. Confirm your backup method, test restoring it on a separate host, and check that the restored node syncs with the expected peers. The upgrade guide describes pulling the new image, stopping the container and starting it again with the same data, which makes the backup your only rollback path. Write down who approves the upgrade and the point after which rollback is no longer possible.

Does my secrets and file-mounting approach keep the node key safe?

Not by default. The Besu documentation says the local node private key file is not encrypted, so anyone who can read that file can impersonate the node. Confirm which user can read the key file, whether the key is inside an image layer, and whether your secrets tooling mounts it read-only. If you need hardware-backed key storage, confirm whether a security module plugin fits your environment, such as the Besu HSM plugin used with the --security-module option, and test it before you rely on it. Include the key files in your backup and rotation plan.

Does my permissions file mount work the way the Besu docs describe?

Confirm it by starting a node and checking the logs. The Besu local permissioning documentation says the --permissions-accounts-config-file and --permissions-nodes-config-file options are not used with the Docker image, and a bind mount supplies the permissions file instead. Verify that the file path inside the container matches the mount, that the file is readable by the container user, and that a change to the file is picked up after a restart. Test that a disallowed peer is rejected, so you know the permissions file is in effect.

Official Besu sources for Docker deployments

Before you finalize a Docker deployment, read three official Besu references. The local permissioning docs answer how node and account permissions are supplied to a container. The Besu docs: Use local permissioning page explains the node permissions file and the account permissions file, and it notes that the --permissions-accounts-config-file and --permissions-nodes-config-file options are not used with the Docker image, so a bind mount must supply the permissions file. Use it to confirm the container path your permissions files will occupy and how the same files stay consistent across every node in your network.

The upgrade guide answers how to move a running container to a new image without losing state. Besu's Besu docs: Upgrade your node page covers the Docker procedure of pulling the new hyperledger/besu image, stopping the container and starting it again with the same data. Read it alongside your own runbook, and confirm that your data volume is the one mounted on the new container before you stop the old one. Treat the guide as the baseline, then add the backup and rollback steps your change process requires.

The Besu releases on GitHub page is where you check what each version changes. Besu ships calendar-versioned releases, and the release notes are where behavior changes appear, such as removed features, new JDK requirements and runtime defaults like the out-of-memory exit behavior noted for 26.9.0. Check the current release notes before each upgrade, including the notes for every version between your current image and the target, and record which items affect your configuration, restart policy or database. Where a release notes an automatic database upgrade, plan a backup before the upgrade, because older versions may not be able to open the upgraded data.

How DeployOpen scopes and supports Besu container deployments

DeployOpen plans and deploys Hyperledger Besu containers inside infrastructure you control, with data volumes, genesis and permissions files, restart behavior and upgrade steps written down before go-live. Each engagement is agreed as a fixed scope with named deliverables, so your team knows what is built, tested and handed over.

How we scope

  • We review your node roles, data volume layout, genesis and permissions files, and container host setup before work starts.
  • The written scope names which Besu versions, images, and restart and upgrade procedures are covered.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.

How we build

  • We configure persistent volumes and bind mounts so the node keeps its data and permissions file across container replacements.
  • We set restart policies and the JVM exit behavior after out-of-memory events, and test them against your node's workload.
  • We script image upgrades with a verified backup taken before each change, so rollback stays possible.

How we hand over

  • You receive the compose or run definitions, configuration files and a runbook covering volumes, upgrades and recovery steps.
  • We document the backup and restore test results, along with the tested rollback path for each Besu version.
  • Your team walks through the runbook with us, and we confirm which steps your operators will own after go-live.

How we support

  • Support covers the Besu release cycle, so each new image is reviewed against your configuration before you pull it.
  • Retesting follows every upgrade, including restart behavior and volume persistence in your environment.
  • Ask any support provider to confirm response terms, escalation paths and who holds the backup keys before signing.

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.