{#snippet trailing()} {#if targetEnv} {mode === 'in-place' ? 'on' : 'to'} {targetEnvName} {/if} {/snippet} Restore snapshot {snapshotId.slice(0, 8)} for {containerName}.
{#if loading}
Reading snapshot…
{:else if restoreStatus !== 'idle'}
{#if restoreStatus === 'running'} Restoring… {:else if restoreStatus === 'success'} Restore completed — {mode === 'new-location' ? `restored to ${targetEnvName}${postRestore !== 'none' ? (targetIsStack ? ', stack redeployed' : ', container recreated') : ''}` : `live volume replaced — restart ${containerName}${hasStackFiles ? ' / redeploy the stack' : ''} to use it`}. {:else if restoreStatus === 'warning'} Restore completed with warnings — {restoreWarning} {:else} {error || 'Restore failed'} {/if}
{:else}
{#if error}

{error}

{/if}
1
Where does it go? — pick where, and how
{#if mode === 'new-location'}
(targetEnvId = v ? parseInt(v) : undefined)}> {#if targetEnv} {targetEnv.name} {:else} Select an environment… {/if} {#each envList as env} {env.name} {/each}
{/if}
2
{mode === 'in-place' ? 'What gets overwritten?' : 'What gets restored?'} — {selectedRows.length} of {volumes.length} {volumes.length === 1 ? 'volume' : 'volumes'} {#if mode === 'new-location'}

Each destination is resolved by {targetEnvName || 'the target'}'s Docker daemon: a host path must exist on that host (not on Dockhand's), while a named volume is created there. Prefer named volumes for portability. The post-restore step brings the {targetIsStack ? 'stack' : 'container'} up; if it fails, the data is still restored and you finish manually.

{/if}
{#if volumes.length === 0}

This snapshot has no volumes — restore recreates the {targetIsStack ? 'stack' : 'container'} from its saved config.

{#if showSecretRestore || (mode === 'new-location' && targetIsStack && hasStackFiles)}
{@render secretRestoreBlock()}{@render stackRestoreOptions()}
{/if} {:else if mode === 'new-location'}
{#each volumes as vol}
{#if vol.selected}
→ onDestKindChange(vol, v as 'volume' | 'path')}> {#if vol.destKind === 'path'} Host path {:else} Volume {/if} Volume Host path
{#if vol.conflict}

Volume {vol.dest} already exists on {targetEnvName}. Remove it or choose another destination.

{:else if vol.pathInvalid}

A host path must be absolute — start it with / (e.g. /srv/{vol.name}).

{/if} {/if}
{/each} {@render secretRestoreBlock()} {@render stackRestoreOptions()}
{:else}
{#each volumes as vol} {/each} {@render secretRestoreBlock()} {@render stackRestoreOptions()}
{/if} {@render hostTargetsBlock()}
3
Then what? — {mode === 'in-place' ? 'bring it back up' : 'bring it up on the target'}
{#if mode === 'new-location'}
{ postRestore = v as PostRestore; postRestoreUserPicked = true; }}> {#each postRestoreOptions as opt} {#if opt.value === postRestore} {@const OptIcon = opt.icon} {opt.label} {/if} {/each} {#each postRestoreOptions as opt} {@const OptIcon = opt.icon} {opt.label} {/each} {#if nameConflict}

A {targetIsStack ? 'stack' : 'container'} named {containerName} already exists on {targetEnvName}. Remove it or choose "Do nothing" — the restore won't overwrite it.

{/if}
{:else}
{ postRestore = v as PostRestore; postRestoreUserPicked = true; }}> {#each postRestoreOptions as opt} {#if opt.value === postRestore} {@const OptIcon = opt.icon} {opt.label} {/if} {/each} {#each postRestoreOptions as opt} {@const OptIcon = opt.icon} {opt.label} {/each}
{/if}
{#snippet hostDataBadge(kind: ProbeKind)} {#if kind === 'has-data'} has data {:else if kind === 'empty'} empty {:else if kind === 'missing'} new {/if} {/snippet} {#snippet kindBadge(kind: 'volume' | 'bind')} {#if kind === 'bind'} bind {:else} vol {/if} {/snippet} {#snippet hostTargetsBlock()} {#if helperError}
The backup helper can't run on {targetEnvName || 'this environment'}
{helperError}
A restore can't run until this is fixed - the same helper writes the restored data.
{:else if targetPreviewError && !targetPreviewLoading}
Couldn't check the target paths
{targetPreviewError}
{:else if targetPreview && targetPreview.unresolved.length > 0}
{#each targetPreview.unresolved as u}
{u.key} - {u.reason}
{/each}
{/if} {/snippet} {#snippet envChip(env: { id: number; icon?: string | null } | undefined, name: string)} {#if env}{/if}{name || '…'} {/snippet} {#snippet secretRestoreBlock()} {#if showSecretRestore}
{#each sourceSecretKeys as key} {key} {/each}
{#if restoreSecrets}
Secrets are encrypted with this Dockhand instance's key. Restoring on a different instance requires the same encryption key (.encryption_key / ENCRYPTION_KEY), or they stay unreadable.
{/if}
{/if} {/snippet} {#snippet stackRestoreOptions()} {#if mode === 'new-location' && targetIsStack && hasStackFiles}
{/if} {/snippet}
{#if mode === 'in-place'}{:else}{/if} What will happen
{#if mode === 'in-place'}

The snapshot{#if backupTime} taken {formatDateTime(backupTime)}{/if}{#if sourceEnvName} from {@render envChip(sourceEnv, sourceEnvName)}{/if} will overwrite the live data{#if targetEnvName} on {@render envChip(targetEnv, targetEnvName)}{/if}{#if selectedRows.length > 0}:{:else}.{/if}

{#if selectedRows.length > 0}
    {#each selectedRows as v} {@const t = targetPreview?.volumes.find((x) => x.key === v.name)}
  • {#if v.type === 'bind'}{:else}{/if} {#if v.type === 'bind'}bind{:else}vol{/if} {v.name} {#if v.type === 'bind' && (t?.target ?? v.origDest)} → host path {t?.target ?? v.origDest} {:else} wiped & replaced {/if}
  • {/each}
{/if}

The {targetIsStack ? 'stack' : 'container'} is stopped before the restore (expect downtime); the volumes are swapped (staged then committed), then {postRestoreLabel.toLowerCase()}.

{:else}

The snapshot{#if backupTime} taken {formatDateTime(backupTime)}{/if}{#if sourceEnvName} from {@render envChip(sourceEnv, sourceEnvName)}{/if} will be restored to {@render envChip(targetEnv, targetEnvName)}{#if selectedRows.length > 0}:{:else}.{/if}

{#if selectedRows.length > 0}
    {#each selectedRows as v} {@const probe = probeByKey.get(v.name)}
  • {@render kindBadge(v.type)} {v.name} → {@render kindBadge(v.destKind === 'path' ? 'bind' : 'volume')} {v.dest.trim() || '…'} {#if v.dest.trim()} {#if probe}{@render hostDataBadge(probe)} {:else if targetPreviewLoading}checking on{#if targetEnv}{/if}{targetEnvName || 'host'}{/if} {/if}
  • {/each}
{#if targetsWithData > 0} {/if} {/if} {#if postRestore !== 'none'}

Then Dockhand will {postRestoreLabel.toLowerCase()} on {@render envChip(targetEnv, targetEnvName)}{#if sourceEnvName && sourceEnvName !== targetEnvName}. Nothing on {@render envChip(sourceEnv, sourceEnvName)} is touched{/if}.

{:else}

The {targetIsStack ? 'stack' : 'container'} is not started — the data lands on {@render envChip(targetEnv, targetEnvName)} and you bring it up yourself.

{/if} {#if showSecretRestore}

{#if restoreSecrets} Its {sourceSecretKeys.length} secret{sourceSecretKeys.length === 1 ? '' : 's'} will be restored from the backup. {:else} Its {sourceSecretKeys.length} secret{sourceSecretKeys.length === 1 ? '' : 's'} will not be restored — set {sourceSecretKeys.length === 1 ? 'it' : 'them'} by hand afterwards. {/if}

{/if} {#if hasRemap}
You have changed a volume's name or type

Your data goes to the new volumes. But the {targetIsStack ? 'stack redeploys from the stored compose file, which still names' : 'recreated container mounts'} the original ones — so it {targetIsStack ? 'starts with empty volumes' : "won't see the restored data"}.

After restoring: {targetIsStack ? 'update the compose file to the new volume names, then redeploy.' : 'edit the container and point the mount at the new volume.'}

{#if postRestore === 'none'}

Next step set to Do nothing so it can't start with the wrong data.

{/if}
{/if} {/if}
{/if}
{#if restoreStatus === 'success' || restoreStatus === 'warning' || restoreStatus === 'error'} {:else if restoreStatus !== 'running'} {#if !loading} {/if} {/if}