Skip to content

Version the FreeSurfer data volume so image updates re-seed it (fixes #123)#131

Merged
idossha merged 3 commits into
mainfrom
fix/freesurfer-volume-versioning
Jul 9, 2026
Merged

Version the FreeSurfer data volume so image updates re-seed it (fixes #123)#131
idossha merged 3 commits into
mainfrom
fix/freesurfer-volume-versioning

Conversation

@idossha

@idossha idossha commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Problem

The FreeSurfer install is shared into the simnibs container via a Docker named volume. Docker only seeds a volume once (on first creation). With a fixed name (ti-toolbox_freesurfer_data), pulling a newer freesurfer image never refreshed it — so users who installed before the image gained the MATLAB runtime (MCR) kept an MCR-less volume, breaking segmentThalamicNuclei.sh / segmentHA_T1.sh (#123).

Fix

  1. Version the volume name by the freesurfer image tag (ti-toolbox_freesurfer_data_v7.4.1) — bumping the image bumps the name → a fresh volume is created and re-seeded.
  2. Make it compose-managed (drop external) so docker compose up creates/seeds it; a bare docker compose up works too.
  3. Launchers derive the name from the compose image tag, pass FREESURFER_VOLUME, and prune stale older-version volumes (best-effort, scoped to the FreeSurfer prefix, never the current one).

Consistent across all three launchers (loader.py, dev/loader/loader_dev.py, package/src/backend/docker-manager.js) and three compose files. See dev/freesurfer-volume-versioning.md.

Notes

  • docker compose down keeps the volume; only down -v removes it. Existing users' old volume is pruned + re-seeded on next launch.
  • Maintenance: when bumping the FreeSurfer image, update the tag and the ${FREESURFER_VOLUME:-…} default in all three compose files.
  • This is Docker/launcher infra (no automated test coverage) — recommend a one-time smoke test of a fresh launch.

idossha added 3 commits June 13, 2026 14:40
The FreeSurfer install is shared into the simnibs container via a Docker
named volume. Docker only seeds a volume once (when empty), so the fixed
volume name pinned the first install forever and never picked up updated
freesurfer images — users who installed before the image gained the MATLAB
runtime kept an MCR-less volume, breaking thalamic/hippocampal segmentation
(issue #123).

Version the volume name by the freesurfer image tag and make it
compose-managed (not external) so compose creates and seeds it
automatically. Launchers derive the name from the image tag, pass it as
FREESURFER_VOLUME, and prune stale older-version volumes.
…unchers

Address review findings on the volume-versioning change:

- Non-destructive fallback (all 3 launchers): when the freesurfer image tag
  cannot be parsed, get_freesurfer_volume_name()/computeFreesurferVolume() now
  returns None/null instead of the bare "ti-toolbox_freesurfer_data" prefix.
  Callers then leave FREESURFER_VOLUME unset (so compose's versioned
  ${FREESURFER_VOLUME:-ti-toolbox_freesurfer_data_v7.4.1} default seeds the
  correct volume) and skip pruning. Previously a parse miss both regressed to
  the never-re-seeded issue #123 and deleted the good versioned volume.

- Unmount before prune (Python loaders): run "docker compose down" before
  prune_old_freesurfer_volumes() so containers from a previous (older-image)
  run release the old volume and it can actually be removed. This mirrors the
  Electron cleanupExistingContainers -> pruneOldVolumes ordering.

- Anchor JS regex (docker-manager.js): match /^\s*image:.../m so commented-out
  "# image:" lines are skipped and only the first real image line wins,
  matching the Python re.match(^\s*...) semantics.
@idossha
idossha merged commit 2575765 into main Jul 9, 2026
4 checks passed
@idossha
idossha deleted the fix/freesurfer-volume-versioning branch July 9, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant