Stacks - Dockhand
{#if stacks.length > 0} {/if}
e.key === 'Escape' && (searchInput = '')} class="pl-8 h-8 w-48 text-sm" />
s.updatesAvailable)} onComplete={(result) => { // Record failed checks so stack containers show a "check failed" state // instead of masquerading as up to date (#1255). Session-only. const failed = result.failed ?? []; failedUpdateCheckIds = new Set(failed.map((f) => f.containerId)); failedUpdateCheckErrors = new Map(failed.map((f) => [f.containerId, f.error])); fetchStacks(); }} /> {#if hasUpdateIndicators} {/if} {#if $canAccess('stacks', 'create')} {/if}
{#if selectedStacks.size > 0}
{selectedInFilter.length} selected {#if selectedStopped.length > 0 && $canAccess('stacks', 'start')} confirmBulkStart = open} > {#snippet children({ open })} Start {/snippet} {/if} {#if selectedRunning.length > 0 && $canAccess('stacks', 'restart')} confirmBulkRestart = open} > {#snippet children({ open })} Restart {/snippet} {/if} {#if selectedRunning.length > 0 && $canAccess('stacks', 'stop')} confirmBulkStop = open} > {#snippet children({ open })} Stop {/snippet} {/if} {#if selectedRunning.length > 0 && $canAccess('stacks', 'stop')} confirmBulkDown = open} > {#snippet children({ open })} Down {/snippet} {/if} {#if $canAccess('stacks', 'remove')} confirmBulkRemove = open} > {#snippet children({ open })} Remove {/snippet} {/if}
{/if}
{#if !loading && ($environments.length === 0 || !$currentEnvironment)} {:else if !loading && stacks.length === 0} {:else}
saveExpandedState()} sortState={{ field: sortField, direction: sortDirection }} onSortChange={(state) => { sortField = state.field as SortField; sortDirection = state.direction; }} onRowClick={(stack, e) => { toggleExpand(stack.name); }} rowClass={(stack) => { const isExp = expandedStacks.has(stack.name); const isSel = selectedStacks.has(stack.name); return `${isExp ? 'bg-muted/40' : ''} ${isSel ? 'bg-muted/30' : ''}`; }} > {#snippet cell(column, stack, rowState)} {@const source = getStackSource(stack.name)} {#if column.id === 'name'} {@const systemType = getStackSystemType(stack)} {#if systemType} {#if systemType === 'dockhand'} {:else} {/if} {systemType === 'dockhand' ? 'Dockhand' : 'Hawser'}

{systemType === 'dockhand' ? 'Dockhand management container' : 'Hawser remote agent'}

{/if} {#if stackEnvVarCounts[stack.name]} {stackEnvVarCounts[stack.name]} {stackEnvVarCounts[stack.name]} environment variable{stackEnvVarCounts[stack.name] !== 1 ? 's' : ''} configured {/if} {#if stack.updatesAvailable && $appSettings.highlightUpdates} {#if source.sourceType === 'git' && source.gitStack} {#snippet children()} {/snippet} {:else if source.sourceType !== 'external' && $canAccess('stacks', 'start')} redeployStack(stack.name, options)} > {#snippet children()} {#if (stack.updateCount ?? 0) > 1} {stack.updateCount} {/if} {/snippet} {:else} {#if (stack.updateCount ?? 0) > 1} {stack.updateCount} {/if} External stack - update possible for individual containers only. {/if} {/if}
{:else if column.id === 'source'} {#if source.sourceType === 'git'} {:else if source.sourceType === 'internal'} Internal Managed by Dockhand {:else} Untracked Compose file location unknown. Click the stack name or edit button to locate it. {/if} {:else if column.id === 'location'} {#if source.composePath} {@const dirPath = source.composePath.replace(/\/[^/]+$/, '')} {dirPath} {source.composePath} {:else} Not set {/if} {:else if column.id === 'containers'}
{#if getContainerStateCounts(stack).running} {getContainerStateCounts(stack).running} Running {/if} {#if getContainerStateCounts(stack).exited} {getContainerStateCounts(stack).exited} Exited {/if} {#if getContainerStateCounts(stack).paused} {getContainerStateCounts(stack).paused} Paused {/if} {#if getContainerStateCounts(stack).restarting} {getContainerStateCounts(stack).restarting} Restarting {/if} {#if getContainerStateCounts(stack).created} {getContainerStateCounts(stack).created} Created {/if} {#if getContainerStateCounts(stack).dead} {getContainerStateCounts(stack).dead} Dead {/if} {#if stack.containers.length === 0} - {/if}
{:else if column.id === 'cpu'} {@const stats = getStackStats(stack)}
{#if stats} {stats.cpuPercent.toFixed(1)}% {:else if stack.status === 'running' || stack.status === 'partial' || stack.status === 'restarting'} ... {:else} - {/if}
{:else if column.id === 'memory'} {@const stats = getStackStats(stack)}
{#if stats} {formatBytesCompact(stats.memoryUsage)}/{formatBytesCompact(stats.memoryLimit, 0)} {:else if stack.status === 'running' || stack.status === 'partial' || stack.status === 'restarting'} ... {:else} - {/if}
{:else if column.id === 'networkIO'} {@const stats = getStackStats(stack)}
{#if stats} ↓{formatBytesCompact(stats.networkRx, 0)} ↑{formatBytesCompact(stats.networkTx, 0)} {:else if stack.status === 'running' || stack.status === 'partial' || stack.status === 'restarting'} ... {:else} - {/if}
{:else if column.id === 'diskIO'} {@const stats = getStackStats(stack)}
{#if stats} r{formatBytesCompact(stats.blockRead, 0)} w{formatBytesCompact(stats.blockWrite, 0)} {:else if stack.status === 'running' || stack.status === 'partial' || stack.status === 'restarting'} ... {:else} - {/if}
{:else if column.id === 'networks'} {getStackNetworkCount(stack) || '-'} {:else if column.id === 'volumes'} {getStackVolumeCount(stack) || '-'} {:else if column.id === 'status'} {@const displayStatus = getDisplayStatus(stack)} {@const StatusIcon = getStackStatusIcon(displayStatus)} {displayStatus} {:else if column.id === 'actions'}
{#if operationError?.id === stack.name && operationError?.message}
{operationError.message}
{/if} {#if (stack.status === 'not deployed' || stack.status === 'created') && source.gitStack} {#snippet children()} {/snippet} {:else} {#if source.sourceType === 'git' && source.gitStack} {#snippet children()} {/snippet} {/if} {#if $canAccess('stacks', 'edit')} {#if source.sourceType === 'git' && source.gitStack} {:else} {/if} {/if} {#if stack.containers && stack.containers.length > 0} {/if} {#if source.sourceType !== 'git' && source.sourceType !== 'external' && $canAccess('stacks', 'start')} redeployStack(stack.name, options)} > {#snippet children()} {/snippet} {/if} {#if stackActionLoading === stack.name}
{:else if stack.status !== 'running' && stack.status !== 'partial' && stack.status !== 'restarting'} {#if $canAccess('stacks', 'start')} {/if} {:else} {#if $canAccess('stacks', 'restart')} restartPopoverOpen[stack.name] = v}> {#snippet child({ props })} {/snippet}
Restart stack {stack.name.length > 20 ? stack.name.slice(0, 20) + '...' : stack.name}
{/if} {#if $canAccess('stacks', 'stop')} stopStack(stack.name)} onOpenChange={(open) => confirmStopName = open ? stack.name : null} > {#snippet children({ open })} {/snippet} {/if} {/if} {/if} {#if $canAccess('stacks', 'stop') && stack.status !== 'created' && stack.status !== 'not deployed'} downStack(stack.name)} onOpenChange={(open) => confirmDownName = open ? stack.name : null} > {#snippet children({ open })} {/snippet} {/if} {#if $canAccess('stacks', 'remove')} {/if}
{/if} {/snippet} {#snippet expandedRow(stack, rowState)} {#if stack.containerDetails?.length > 0}
{#each stack.containerDetails as container (container.id)} {@const isLoading = containerActionLoading === container.id}
{container.service} {#if container.updateAvailable && $appSettings.highlightUpdates} {#if $canAccess('containers', 'manage')} updateSingleContainer(container.id, container.name)} > {#snippet children({ open })} {/snippet} {/if} {#if $appSettings.showImageChangelogLinks} {@const changelogUrl = resolveChangelogUrl(container.image, container.labels)} {#if changelogUrl} e.stopPropagation()} title="View changelog" class="shrink-0 text-amber-500 hover:text-amber-400 transition-colors" > {/if} {/if} {:else if failedUpdateCheckIds.has(container.id)}

Update check failed

{failedUpdateCheckErrors.get(container.id) ?? 'Could not query registry'}

Update status unknown — often a Docker Hub rate limit. Try again later.

{/if} {#if container.health} {#if container.health === 'healthy'} {:else if container.health === 'unhealthy'} {:else} {/if} {/if} {container.state}
{container.image}
{formatUptime(container.status)} {#if container.restartCount > 0} {container.restartCount} {/if}
{#if container.state === 'running'} {@const stats = containerStats.get(container.id)} {@const history = containerStatsHistory.get(container.id)} {#key statsUpdateCount}
CPU {stats?.cpuPercent?.toFixed(0) ?? '-'}%
{#if history?.cpu && history.cpu.length >= 2} {:else}
{/if}
Mem {stats ? formatBytesCompact(stats.memoryUsage) : '-'}
{#if history?.mem && history.mem.length >= 2} {:else}
{/if}
Net {stats ? formatBytesCompact(stats.networkRx + stats.networkTx) : '-'}
{#if history?.netRx && history.netRx.length >= 2} rx + (history.netTx[i] || 0)), 60, 16)} fill="rgba(34, 197, 94, 0.15)" /> rx + (history.netTx[i] || 0)), 60, 16)} fill="none" stroke="rgb(34, 197, 94)" stroke-width="1" /> {:else}
{/if}
Disk {stats ? formatBytesCompact(stats.blockRead + stats.blockWrite) : '-'}
{#if history?.diskR && history.diskR.length >= 2} r + (history.diskW[i] || 0)), 60, 16)} fill="rgba(251, 146, 60, 0.15)" /> r + (history.diskW[i] || 0)), 60, 16)} fill="none" stroke="rgb(251, 146, 60)" stroke-width="1" /> {:else}
{/if}
{/key} {/if}
{#if parseCustomUrl(container.labels?.['dockhand.url'])} {@const stackParsedUrl = parseCustomUrl(container.labels?.['dockhand.url'])} {#if stackParsedUrl} e.stopPropagation()} class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-primary/10 text-primary hover:bg-primary/20 transition-colors" title="Open {stackParsedUrl.url} in new tab" > {stackParsedUrl.name || stackParsedUrl.url.replace(/^https?:\/\//, '')} {/if} {:else} {#each ($appSettings.honorProxyLabels ? extractTraefikUrls(container.labels) : []) as t} e.stopPropagation()} class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-primary/10 text-primary hover:bg-primary/20 transition-colors" title="Traefik router {t.router} → {t.url}" > {t.url.replace(/^https?:\/\//, '')} {/each} {#each ($appSettings.honorProxyLabels ? extractPangolinUrls(container.labels) : []) as p} e.stopPropagation()} class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-primary/10 text-primary hover:bg-primary/20 transition-colors" title="Pangolin resource {p.resource} → {p.url}" > {p.displayName ?? p.url.replace(/^https?:\/\//, '')} {/each} {#each ($appSettings.honorProxyLabels ? extractCaddyUrls(container.labels) : []) as c} e.stopPropagation()} class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-primary/10 text-primary hover:bg-primary/20 transition-colors" title="Caddy {c.group}: {c.url}" > {c.url.replace(/^https?:\/\//, '')} {/each} {/if} {#if container.ports.length > 0} {@const mappedPorts = formatPorts(container.ports)} {#each mappedPorts as port} {@const portParsed = parseCustomUrl(container.labels?.[`dockhand.port.${port.publicPort}.url`])} {@const portUrl = portParsed?.url || null} {@const url = portUrl || getPortUrl(port.publicPort)} {#if url} e.stopPropagation()} class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded {portUrl ? 'bg-primary/10 text-primary hover:bg-primary/20' : 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 hover:bg-blue-200 dark:hover:bg-blue-800'} transition-colors" title="Open {url} in new tab" > {portParsed?.name ?? port.display} {:else} {port.display} {/if} {/each} {/if} {#if container.networks.length > 0} {@const ip = getContainerIp(container.networks)} {ip !== '-' ? ip : container.networks.length} {#each container.networks as net}
{net.name}: {net.ipAddress || 'no IP'}
{/each}
{/if} {#if container.volumeCount > 0} {container.volumeCount} {/if}
{#if container.state === 'running' && $canAccess('containers', 'exec')} {/if} {#if container.state === 'running' && $canAccess('containers', 'files')} {/if}
{#if operationError?.id === container.id && operationError?.message}
{operationError.message}
{/if} {#if isLoading} {:else} {#if container.state === 'paused'} {#if $canAccess('containers', 'unpause')} {/if} {:else if container.state !== 'running'} {#if $canAccess('containers', 'start')} {/if} {/if} {#if container.state === 'running'} {#if $canAccess('containers', 'restart')} restartContainer(container.id)} onOpenChange={(open) => confirmRestartContainerId = open ? container.id : null} > {#snippet children({ open })} {/snippet} {/if} {#if $canAccess('containers', 'pause')} pauseContainer(container.id)} onOpenChange={(open) => confirmPauseContainerId = open ? container.id : null} > {#snippet children({ open })} {/snippet} {/if} {#if $canAccess('containers', 'stop')} stopContainer(container.id)} onOpenChange={(open) => confirmStopContainerId = open ? container.id : null} > {#snippet children({ open })} {/snippet} {/if} {/if} {/if} {#if $canAccess('containers', 'remove')} removeContainer(container.id)} onOpenChange={(open) => confirmRemoveContainerId = open ? container.id : null} > {#snippet children({ open })} {/snippet} {/if}
{/each}
{:else}
No containers
{/if} {/snippet}
{#if layoutMode === 'vertical' && currentLogsContainerId} {@const activeLog = activeLogs.find(l => l.containerId === currentLogsContainerId)} {#if activeLog}
closeLogs(activeLog.containerId)} />
{/if} {/if}
{#if layoutMode === 'horizontal' && currentLogsContainerId} {@const activeLog = activeLogs.find(l => l.containerId === currentLogsContainerId)} {#if activeLog} closeLogs(activeLog.containerId)} /> {/if} {/if} {/if}
showCreateModal = false} onSuccess={fetchStacks} /> { showEditModal = false; editingStackName = ''; stackModalReadonly = false; stackModalGitInfo = null; }} onSuccess={fetchStacks} /> { showGitModal = false; editingGitStack = null; }} onSaved={fetchStacks} /> showImportModal = false} onAdopted={fetchStacks} /> removeStack(deleteStackName, opts)} /> showFileBrowserModal = false} /> { showBatchUpdateModal = false; singleUpdateContainerId = null; singleUpdateContainerName = null; }} onComplete={handleSingleUpdateComplete} /> showBatchOpModal = false} onComplete={handleBatchComplete} /> {#if errorDialogData} errorDialogData = null} /> {/if}