pub struct ImageConfig {
pub architecture: String,
pub os: String,
pub os_version: Option<String>,
pub os_features: Vec<String>,
pub variant: Option<String>,
pub config: Option<ContainerConfig>,
pub rootfs: RootFs,
pub history: Vec<History>,
pub created: Option<String>,
pub author: Option<String>,
}Expand description
OCI image configuration.
This contains the execution parameters for the container, along with the history and layer diff IDs.
Fields§
§architecture: StringThe CPU architecture.
os: StringThe operating system.
os_version: Option<String>Optional OS version.
os_features: Vec<String>Optional OS features required by the image.
variant: Option<String>Optional architecture variant.
config: Option<ContainerConfig>Container runtime configuration.
rootfs: RootFsLayer content hashes (uncompressed).
history: Vec<History>Build history.
created: Option<String>Creation timestamp (RFC 3339).
Author of the image.
Implementations§
Source§impl ImageConfig
impl ImageConfig
Sourcepub fn new(architecture: impl Into<String>, os: impl Into<String>) -> Self
pub fn new(architecture: impl Into<String>, os: impl Into<String>) -> Self
Creates a new image config with the given architecture and OS.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Parses an image config from JSON bytes.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates the image config for strict OCI requirements.
This currently checks:
- rootfs.type is “layers”
Sourcepub fn with_layer(self, diff_id: Digest) -> Self
pub fn with_layer(self, diff_id: Digest) -> Self
Adds a layer diff ID.
Sourcepub fn with_config(self, config: ContainerConfig) -> Self
pub fn with_config(self, config: ContainerConfig) -> Self
Sets the container configuration.
Sourcepub fn with_history(self, history: History) -> Self
pub fn with_history(self, history: History) -> Self
Adds a history entry.
Sourcepub fn labels(&self) -> Option<&BTreeMap<String, String>>
pub fn labels(&self) -> Option<&BTreeMap<String, String>>
Returns the labels from the container config, if any.
Sourcepub fn entrypoint(&self) -> Option<&[String]>
pub fn entrypoint(&self) -> Option<&[String]>
Returns the entrypoint from the container config, if any.
Trait Implementations§
Source§impl Clone for ImageConfig
impl Clone for ImageConfig
Source§fn clone(&self) -> ImageConfig
fn clone(&self) -> ImageConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more