Members
(constant) EXIT_DELAY
Delay used before exiting the process when showing an exit message.
- Source:
(constant) MESSAGE_TIMEOUTS
Timeout values for UI messages before they disappear.
- Source:
(constant) REFRESH_INTERVALS
Time intervals used across the app (milliseconds).
- CONTAINER_LIST: how often to refresh the list of containers
- CONTAINER_STATS: how often to fetch stats for running containers
- Source:
(constant) TIMEOUTS
Operational timeouts for Docker operations and image pulls.
- Source:
(constant) docker :DockerClient
Shared Docker client instance (dockerode). Consumers import { docker }
and use it to list/create/start/stop containers and images.
Type:
Methods
PromptField(props) → {JSX.Element}
PromptField shows a label and the current typed value for an input field.
The cursor is represented with a trailing underscore.
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object |
Properties
|
- Source:
Returns:
- Type
- JSX.Element
PromptMessage(props) → {JSX.Element|null}
Small helper to show a message below prompts (errors, hints, etc.).
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object |
Properties
|
- Source:
Returns:
- Type
- JSX.Element | null
colorize(value, textopt) → {string}
Colorize a value or text depending on thresholds.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
number | Numeric value used to pick color | |
text |
string |
<optional> |
Text to colorize, defaults to the numeric string |
- Source:
Returns:
- Type
- string
createContainer(imageName, optionsopt) → {Promise.<string>}
Create a new container from an image. If the image is missing locally, it will be pulled.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
imageName |
string | Image name (e.g. 'nginx:alpine') | |
options |
Object |
<optional> |
Docker create options (Env, ExposedPorts, HostConfig, name, etc.) |
Throws:
-
If image listing/pull or creation fails
- Type
- Error
Returns:
The created container id
- Type
- Promise.<string>
exitWithMessage(params)
Show an exit message using provided setters, clear the terminal and exit after a delay.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
- Source:
getContainers() → {Promise.<Array.<Object>>}
Return a list of containers with normalized fields for the UI.
Returns:
- Type
- Promise.<Array.<Object>>
getLogsStream(containerId, onData, onEnd, onError)
Return a stream of logs from a container and call callbacks for events.
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
onData |
function | Called with chunk string when data arrives |
onEnd |
function | Called when stream ends |
onError |
function | Called on error |
getStats(containerId) → {Promise.<Object>}
Retrieve a snapshot of container resource usage (CPU, memory, network).
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
Returns:
Object with cpuPercent, memPercent and netIO {rx,tx}
- Type
- Promise.<Object>
handleAction(params) → {Promise.<void>}
Generic helper to perform a container action with user feedback.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise.<void>
imageExists(imageName) → {Promise.<boolean>}
Check whether an image exists locally.
Parameters:
| Name | Type | Description |
|---|---|---|
imageName |
string | Image name or tag |
Returns:
- Type
- Promise.<boolean>
makeBar(value) → {string}
Build a fixed-width bar representation from a numeric percentage.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Percentage value (0-100) |
- Source:
Returns:
Colored bar string
- Type
- string
pullImage(imageName) → {Promise.<void>}
Pull an image from the registry.
Parameters:
| Name | Type | Description |
|---|---|---|
imageName |
string | Image name to pull |
Returns:
- Type
- Promise.<void>
removeContainer(containerId) → {Promise.<void>}
Remove (delete) a container by id. Force removal so running containers are stopped first.
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
Throws:
-
If Docker reports an error
- Type
- Error
Returns:
Resolves when removal completes
- Type
- Promise.<void>
restartContainer(containerId) → {Promise.<void>}
Restart a container by id.
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
Returns:
- Type
- Promise.<void>
safeCall(fn, …args)
Call a function safely: if it's a function call it with provided args and
catch any errors so they don't bubble to the host application.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
fn |
function | ||
args |
any |
<repeatable> |
- Source:
startContainer(containerId) → {Promise.<void>}
Start a container by id.
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
Returns:
- Type
- Promise.<void>
stopContainer(containerId) → {Promise.<void>}
Stop a container by id.
Parameters:
| Name | Type | Description |
|---|---|---|
containerId |
string | Docker container id |
Returns:
- Type
- Promise.<void>
useContainerActions(params) → {Object}
Custom hook to manage container actions (start, stop, restart, remove).
Handles feedback messages and exposes helpers for each action.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Returns:
Action helpers and feedback state
- Type
- Object
useContainerCreation(params) → {Object}
Custom hook to manage the container creation flow, step by step.
Handles input, validation, and feedback for each creation step.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Returns:
Creation state, setters, and helpers
- Type
- Object
useControls(containers) → {Object}
Main hook that wires user input, creation, actions and logs viewing.
It coordinates the modular hooks and exposes a compact API consumed by the App.
Parameters:
| Name | Type | Description |
|---|---|---|
containers |
Array.<Object> | Current list of Docker containers |
Properties:
| Name | Type | Description |
|---|---|---|
selected |
number | Index of the currently selected container |
setSelected |
function | Setter for selected index |
message |
string | Current feedback message (creation or actions) |
messageColor |
string | Color to show for the feedback message |
showLogs |
boolean | Whether the logs viewer is active |
logs |
Array.<string> | Array of log lines currently collected |
exitLogs |
function | Helper to close the logs viewer |
creatingContainer |
boolean | Whether the create-container prompt is open |
creationStep |
number | Current step in the creation flow |
imageNameInput |
string | Current value of the image name field |
containerNameInput |
string | Current value of the container name field |
portInput |
string | Current value of the port input field |
envInput |
string | Current value of the env input field |
creation |
Object | The creation hook API (setters and helpers) |
actions |
Object | The actions hook API (helpers to start/stop/remove) |
logsViewer |
Object | The logs viewer hook API |
- Source:
Returns:
controls - API for the App component
- Type
- Object
useLogsStream() → {Object}
Hook that manages opening and closing a logs stream for a container.
- Source:
Returns:
{ openLogs, closeLogs }
- Type
- Object
useLogsViewer() → {Object}
Custom hook to manage the logs viewer state and stream reference.
Handles showing/hiding logs and storing log lines.
Properties:
| Name | Type | Description |
|---|---|---|
showLogs |
boolean | Whether the logs viewer is open |
setShowLogs |
function | Setter for showLogs |
logs |
Array.<string> | Array of log lines |
setLogs |
function | Setter for logs |
logsStreamRef |
object | Ref to the logs stream (for cleanup) |
openLogs |
function | Helper to open logs for a container |
closeLogs |
function | Helper to close logs and cleanup |
- Source:
Returns:
Logs viewer state and helpers
- Type
- Object
validateEnvVars(envInput) → {boolean}
Validate environment variable input as comma-separated VAR=value pairs.
Empty or whitespace-only input is considered valid (no env vars).
Variable names must start with a letter or underscore and contain only
alphanumeric characters and underscores.
Parameters:
| Name | Type | Description |
|---|---|---|
envInput |
string | Comma-separated environment variable assignments |
- Source:
Returns:
True when all env var assignments are valid, false otherwise
- Type
- boolean
validatePorts(portInput) → {boolean}
Validate a comma-separated list of port mappings in the form "host:container".
Examples of valid input: "8080:80, 3000:3000"
Parameters:
| Name | Type | Description |
|---|---|---|
portInput |
string | Comma-separated port mappings |
- Source:
Returns:
True when all mappings are valid, false otherwise
- Type
- boolean
withTimeout(promise, msopt) → {Promise.<T>}
Helper to add timeout to promises. If the provided promise does not settle
within `ms` milliseconds it will reject with an Error.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
promise |
Promise.<T> | Promise to wrap | ||
ms |
number |
<optional> |
TIMEOUTS.CONTAINER_OP | Timeout in milliseconds |
Returns:
The original promise result or a rejection on timeout
- Type
- Promise.<T>
Type Definitions
DockerClient
Typedef for the docker client used in this project.
Use a generic object shape so JSDoc can render a meaningful type.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
listContainers |
function | |
getContainer |
function | |
listImages |
function | |
createContainer |
function | |
pull |
function |