Introducing a new way to review your PRs.

Read the announcement

jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing

View on GitHub

19 documents · Updated Oct 19, 2026

docs / node-image-management

Node image management

Node image management gives Polar one place to show the Docker images that can run node services. It combines Polar-managed images with user-defined local images, keeps their startup commands with the image choice, and supplies the image and version data used when a network is created. See also Docker runtime and Bundled Node containers.

Image catalog

The image catalog separates images that Polar publishes from images that the user provides. Both kinds carry a node implementation and a startup command, but only custom images carry a user name and a Docker image reference.

Image kindSourceUser controlsNetwork use
Managed imagePolar's image repository stateChange or reset the startup command for one implementation and versionUses the Polar image name with the selected version tag
Custom imageA Docker image available on the user's machineAdd, edit, or remove the image name, image reference, and commandUses the exact custom image reference

Managed image catalog

A managed image is a Polar-published Docker image identified by its node implementation and version. The screen builds this list from the current repository state, then overlays any command saved by the user for the same implementation and version. This keeps new versions visible without losing command customizations for versions that remain available. References: src/…/app.ts• L31-40, src/…/app.ts• L104-123, src/…/ManagedImagesTable.tsx• L47-59

The managed image table shows the implementation, image name, version, and effective command. A blank command means that the standard command will be used. The edit dialog allows a command override or a reset to the standard command; it does not change the managed image reference. References: src/…/ManagedImagesTable.tsx• L62-107, src/…/ManagedImageModal.tsx• L26-85, src/…/app.ts• L171-182

Custom image catalog

A custom image is a user-defined image reference that Polar expects to find in the local Docker environment. The add and edit dialog records a display name, node implementation, image reference, and startup command. The image reference is refreshed from Docker when the dialog opens so the suggestions reflect the current local image set. References: src/…/index.ts• L49-59, src/…/CustomImageModal.tsx• L18-45, src/…/DockerImageInput.tsx• L13-30

The custom image table appears only when custom images exist on the current platform. Users can edit an entry or remove it after confirmation. Custom images then become choices when a new network is defined, while the saved image record supplies the image and command for the resulting nodes. References: src/…/CustomImagesTable.tsx• L44-89, src/…/CustomImagesTable.tsx• L91-139, src/…/NewNetwork.tsx• L39-47, src/…/network.ts• L309-335

Command customization

Image commands are the startup instructions passed to a node container. Polar keeps the command with the image selection so a managed image can use its default behavior or an explicit override, and a custom image can use the command required by that image.

Command templates

Each node implementation has a default image name, command template, supported platform list, and set of command variables. The same implementation configuration drives the image catalog, the edit forms, and the command used when the container starts. References: src/…/index.ts• L96-107, src/…/constants.ts• L100-132, src/…/constants.ts• L134-167

The command variable list is shown beside the command editor. A variable is written as {{variable}} in a command, and its description explains the value that Polar supplies at runtime. The list must stay aligned with the values that the Docker runtime can provide. References: src/…/CommandVariables.tsx• L11-39, src/…/constants.ts• L131-132, src/…/composeFile.ts• L69-79

Runtime substitutions

When Polar creates a Compose service, it first selects the custom image or the implementation's managed image. It then selects the saved command or the version-aware default command, replaces the supported variables, and passes the result to the container service. This connects an image record to the network names, credentials, and dependent services known only when a network runs. References: src/…/composeFile.ts• L65-105, src/…/composeFile.ts• L108-173, src/…/composeFile.ts• L175-218, src/…/composeFile.ts• L228-236

The command path is summarized below.

flowchart LR
    A[Image record] --> B{Custom image selected?}
    B -- Yes --> C[Custom image and command]
    B -- No --> D[Managed image and version]
    D --> E[Saved command or default command]
    C --> F[Replace command variables]
    E --> F
    F --> G[Docker Compose service]

Version availability

Polar treats the image repository state as the source of truth for supported managed versions. This state includes the latest version, the full version list, and compatibility limits where one node implementation depends on another.

Repository state

The application starts with a built-in repository state and can use a newer state saved in its data directory. The remote state comes from the repository metadata URL. Polar compares state versions and only accepts a remote update when it includes new image versions, which prevents an older remote response from replacing current data. References: src/…/constants.ts• L352-365, src/…/repoService.ts• L10-14, src/…/repoService.ts• L46-91, src/…/app.ts• L223-252

Version updates

Users can check for new node versions from the image update dialog. Polar lists the new versions by implementation and saves the new repository state only after the user accepts it. An optional startup check can show the dialog when a newer state is available. References: src/…/ImageUpdatesModal.tsx• L24-35, src/…/ImageUpdatesModal.tsx• L42-72, src/…/ImageUpdatesModal.tsx• L89-129, src/…/app.ts• L128-138

The version list is also available to the list_node_versions tool. That interface returns supported versions, the latest version for each implementation, and compatibility data. An engineer or an automated tool can therefore inspect the same version choices that guide network creation. References: src/…/listNodeVersions.ts• L8-39, src/…/listNodeVersions.ts• L41-92

Version selection

The network designer presents the latest managed version first and reveals older supported versions on demand. Custom images appear as separate choices and use the latest version for their implementation as the node's version context. The new-network form also exposes custom images alongside managed node counts. References: src/…/NetworkDesignerTab.tsx• L66-115, src/…/NewNetwork.tsx• L105-123

Version data also protects network creation. A requested version must be present in repository state, and the planner checks backend and node compatibility before it accepts a version set. This keeps image choices tied to a network that Polar can connect and start. References: src/…/createNetwork.ts• L117-169, src/…/createNetwork.ts• L221-260, src/…/createNetwork.ts• L307-370

Network image selection

Image management affects a network at two points: node selection chooses the image record, and network startup turns that record into a Docker service. A node with a custom image keeps that exact reference; a managed node resolves its implementation and version to the corresponding Polar image.

Node selection

The designer passes a custom image identifier when a user selects a custom node. For managed nodes it passes the implementation and version. Network creation stores the selected image data with the network so later Compose generation does not depend on the image screen remaining open. References: src/…/NetworkDesignerTab.tsx• L76-114, src/…/network.ts• L360-384

Image availability

Before a network starts, Polar derives the image references required by all its nodes. It uses custom references where present and otherwise forms a managed reference from the Polar repository name, implementation, and node version. It removes images already present and de-duplicates the remaining pull list. References: src/…/network.ts• L693-714, src/…/composeFile.ts• L74-81, src/…/composeFile.ts• L97-105

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep dockerConfigs[*].command and dockerConfigs[*].variables aligned with the substitution values in composeFile.ts and the translated variable descriptions.
  • Keep the managed image version lists and compatibility maps aligned between the built-in repository state and the remote nodes.json contract.
  • Preserve the implementation and version keys used to overlay managed command overrides. A change can silently make saved commands stop applying.
  • Preserve custom image IDs when changing settings or network creation. New-network selections use those IDs to find the saved image record.
  • Keep image selection and missing-image checks consistent. A custom reference must reach both network node data and the Docker pull/start path.

Important failure modes

TriggerConsequenceGuard
A command uses a variable that is not supplied for its implementationThe unresolved placeholder can reach the node process and prevent normal startupUse the variables shown for that implementation and keep the config, Compose substitution map, and descriptions aligned
A custom image is removed from the local Docker environmentA network can refer to an image that Docker cannot start or pull as expectedRefresh the image list before saving and keep the selected image available locally
A requested managed version is absent from repository stateNetwork creation cannot produce a valid managed image choiceValidate versions against the current repository state before planning the network
Node versions violate backend compatibility rulesNetwork creation is rejected because the selected containers cannot form a supported stackUse the repository compatibility data when selecting Bitcoin, LND, litd, and Taproot Assets versions
A newer repository state is available but not acceptedThe new versions do not appear in the managed catalogRun the update check and accept the returned repository state

Key files

FileWhy to read it
src/…/NodeImagesView.tsxMain image management screen and the boundary between custom and managed image views
src/…/ManagedImagesTable.tsx and src/…/ManagedImageModal.tsxManaged image display, command override, and reset behavior
src/…/CustomImagesTable.tsx and src/…/CustomImageModal.tsxCustom image lifecycle and its link to local Docker image choices
src/…/CommandVariables.tsxUser-facing contract for command placeholders
src/…/app.tsImage settings, computed managed catalog, Docker image refresh, and repository updates
src/…/constants.tsImplementation image definitions, default commands, variables, and built-in version metadata
src/…/repoService.tsRemote version checks and local repository-state persistence
src/…/network.tsTransfer of selected image data into network nodes
src/…/composeFile.tsFinal image and command selection for Docker services
src/…/network.tsManaged default commands and the image pull list for a network
src/…/createNetwork.tsVersion validation and compatibility checks during network planning