Skip to content

#[final] Image

A container image.

Fields

architecture @ Str [get, set]

CPU architecture, such as "amd64".

cmd @ (Array[Str] | nil) [get, set]

Default command, or nil when unset.

created @ Str [get, set]

Creation timestamp, as the runtime reports it.

entrypoint @ (Array[Str] | nil) [get, set]

Entrypoint, or nil when unset.

env @ Dict[Str, Str] [get, set]

Environment variables.

id @ Str [get, set]

Full image ID, sha256:....

labels @ (Dict[Str, Str] | nil) [get, set]

Labels, or nil when the image has none.

layers @ Array[Str] [get, set]

Layer digests.

os @ Str [get, set]

Operating system, such as "linux".

size @ Int [get, set]

Image size in bytes.

user @ (Str | nil) [get, set]

Default user, or nil when unset.

working_dir @ (fs.Path | nil) [get, set]

Working directory, or nil when unset.

Methods

remove …

Removes the image.

img.remove()
img.remove force: true

Parameters

NameTypeDescription
:force? Bool Remove the image even if containers use it, removing them too.

save target … -> (Str | fs.Path)

Saves the image to an archive or directory, returning target.

Parameters

NameTypeDescription
target (Str | fs.Path) Archive path or directory to write.
:format? ArchiveFormat Archive format.
:platform? Platform Platform to save.

tag new_tag

Tags the image with a new name.

img.tag "registry.example.com/myapp:v1.2"

Parameters

NameTypeDescription
new_tag Str Reference to tag the image as.

tags() -> Array[ImageTag]

Returns the current tags, which are empty for an untagged image.