Struct oci_spec::runtime::Spec [−][src]
pub struct Spec {
pub version: String,
pub root: Option<Root>,
pub mounts: Option<Vec<Mount>>,
pub process: Option<Process>,
pub hostname: Option<String>,
pub hooks: Option<Hooks>,
pub annotations: Option<HashMap<String, String>>,
pub linux: Option<Linux>,
pub solaris: Option<Solaris>,
pub windows: Option<Windows>,
pub vm: Option<VM>,
}
Expand description
Base configuration for the container.
Fields
version: String
MUST be in SemVer v2.0.0 format and specifies the version of the Open Container Initiative Runtime Specification with which the bundle complies. The Open Container Initiative Runtime Specification follows semantic versioning and retains forward and backward compatibility within major versions. For example, if a configuration is compliant with version 1.1 of this specification, it is compatible with all runtimes that support any 1.1 or later release of this specification, but is not compatible with a runtime that supports 1.0 and not 1.1.
root: Option<Root>
Specifies the container’s root filesystem. On Windows, for Windows Server Containers, this field is REQUIRED. For Hyper-V Containers, this field MUST NOT be set.
On all other platforms, this field is REQUIRED.
mounts: Option<Vec<Mount>>
Specifies additional mounts beyond root
. The runtime MUST mount
entries in the listed order.
For Linux, the parameters are as documented in
mount(2)
system call man page. For
Solaris, the mount entry corresponds to the ‘fs’ resource in the
zonecfg(1M)
man page.
process: Option<Process>
Specifies the container process. This property is REQUIRED when
start
is
called.
hostname: Option<String>
Specifies the container’s hostname as seen by processes running inside the container. On Linux, for example, this will change the hostname in the container UTS namespace. Depending on your namespace configuration, the container UTS namespace may be the runtime UTS namespace.
hooks: Option<Hooks>
Hooks allow users to specify programs to run before or after various lifecycle events. Hooks MUST be called in the listed order. The state of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.
annotations: Option<HashMap<String, String>>
Annotations contains arbitrary metadata for the container. This information MAY be structured or unstructured. Annotations MUST be a key-value map. If there are no annotations then this property MAY either be absent or an empty map.
Keys MUST be strings. Keys MUST NOT be an empty string. Keys SHOULD be named using a reverse domain notation - e.g. com.example.myKey. Keys using the org.opencontainers namespace are reserved and MUST NOT be used by subsequent specifications. Runtimes MUST handle unknown annotation keys like any other unknown property.
Values MUST be strings. Values MAY be an empty string.
linux: Option<Linux>
Linux is platform-specific configuration for Linux based containers.
solaris: Option<Solaris>
Solaris is platform-specific configuration for Solaris based containers.
windows: Option<Windows>
Windows is platform-specific configuration for Windows based containers.
vm: Option<VM>
VM specifies configuration for Virtual Machine based containers.
Implementations
Load a new Spec
from the provided JSON file path
.
Errors
This function will return an OciSpecError::Io if the spec does not exist or an OciSpecError::SerDe if it is invalid.
Example
use oci_spec::runtime::Spec;
let spec = Spec::load("config.json").unwrap();
Save a Spec
to the provided JSON file path
.
Errors
This function will return an OciSpecError::Io if a file cannot be created at the provided path or an OciSpecError::SerDe if the spec cannot be serialized.
Example
use oci_spec::runtime::Spec;
let mut spec = Spec::load("config.json").unwrap();
spec.save("my_config.json").unwrap();
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Spec
impl UnwindSafe for Spec
Blanket Implementations
Mutably borrows from an owned value. Read more