docker-compose.yml, and restoring the data into a fresh PostgreSQL 18 container.
Prerequisites
- Docker with the Compose V2 plugin (
docker compose, notdocker-compose) - Sufficient free disk space for the database dump file and a volume backup
- PowerShell 5.1 or later (all platforms), or bash (Linux/macOS)
- Your BloodHound CE installation must be accessible and running before you begin
Before you begin
The upgrade scripts perform the following steps in order:| Step | What it does |
|---|---|
| 1. Stop app, keep database running | Stops the BloodHound application container while leaving PostgreSQL 16 running so the database can be dumped cleanly |
| 2. Dump the database | Exports the PostgreSQL 16 database to a compressed dump file on your host |
| 3. Stop all containers | Brings down all containers before modifying the volume |
| 4. Back up the data volume | Copies the PostgreSQL 16 Docker volume to a backup volume for safety |
5. Update docker-compose.yml | Changes the image tag to postgres:18 and updates the volume mount path; saves a backup of the original compose file |
| 6. Start PostgreSQL 18 and restore | Removes the old volume, starts PostgreSQL 18, and restores the database from the dump file |
| 7. Start the full stack | Brings up all BloodHound CE containers |
Run the upgrade script
Save the following script to a file and run it.- PowerShell (all platforms)
- Linux/macOS (bash)
Save the script as
upgrade-pg.ps1 and run it with .\upgrade-pg.ps1.Verify the upgrade
After the script finishes running, confirm that the database is healthy and your data is intact.Check the container status
Confirm all containers are running:The
app-db container should show a status of healthy.Confirm the PostgreSQL version
Confirm that PostgreSQL 18 is running:The output should include
PostgreSQL 18.Clean up
After you have verified that the upgrade was successful and your data is intact, remove the temporary files and backup volume created during the migration. Replace the placeholder values with the actual paths and volume name printed by the script.- PowerShell (all platforms)
- Linux/macOS (bash)