Container
A running or stopped container.
Fields
cmd @ (Array[Str] | nil)[get, set]Command, or
nilwhen unset.created @ (Str | nil)[get, set]Creation timestamp, as the runtime reports it.
entrypoint @ (Array[Str] | nil)[get, set]Entrypoint, or
nilwhen unset.id @ Str[get, set]Full container ID.
image @ (Str | nil)[get, set]Image reference the container was created from.
image_id @ (Str | nil)[get, set]ID of the image the container was created from.
labels @ (Dict[Str, Str] | nil)[get, set]Labels, or
nilwhen the container has none.
Methods
kill()
Kills the container.
remove …
Removes the container.
Parameters
| Name | Type | Description |
|---|---|---|
:force? |
Bool |
Remove the container even if it is running. |
:volumes? |
Bool |
Also remove its anonymous volumes. |
restart …
Restarts the container.
Parameters
| Name | Type | Description |
|---|---|---|
:timeout? |
Int |
Seconds to wait before killing the container. Defaults to the runtime's. |
start()
Starts the container.
state() -> ContainerState
Returns the container's live state.
stop …
Stops the container.
Parameters
| Name | Type | Description |
|---|---|---|
:timeout? |
Int |
Seconds to wait before killing the container. Defaults to the runtime's. |
wait()
Waits for the container to stop.
Errors
ContainerExitError for a nonzero
exit status.
with[R] func … -> R
Runs func in this running container through a VFS context.
Filesystem access, spawned programs, environment, and working directory use
the container for the duration of func. A dolang-vfs helper is copied
into the container's /tmp and removed once the connection starts, if the
container user may remove it.
Parameters
| Name | Type | Description |
|---|---|---|
func |
(() -> R) |
Block to run. |
:cd? |
(Str | fs.Path) |
Initial working directory. |
:env? |
Env |
Environment overrides. nil unsets a variable. |