#[non_exhaustive]pub struct ContainerSpec {
pub name: String,
pub project: String,
pub resource: String,
pub image: ImageSource,
pub env: HashMap<String, String>,
pub ports: Vec<PortBinding>,
pub volumes: Vec<VolumeBinding>,
pub entrypoint: Option<Vec<String>>,
pub command: Option<Vec<String>>,
pub healthcheck: Option<HealthcheckSpec>,
pub working_dir: Option<String>,
}Expand description
Self-contained description of a container to start, derived from a manifest resource declaration.
All fields are fully resolved: defaults have been applied, optional values materialised, and duration strings parsed. Consumers (the runtime and the export pipeline) can use this struct directly without any further resolution.
Produced by from_resource when resolving a manifest, or built
directly via ContainerSpec::new by consumers that synthesize a
spec themselves.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringContainer name, of the form <project>_<resource>.
Used as the actual container name when starting the container and as the DNS hostname reachable by other containers in the same network.
project: StringProject name as declared in the manifest.
Attached as a container label so that lightshuttle ps and
lightshuttle down can filter by project.
resource: StringResource name as declared in the manifest.
Attached as a container label so that the CLI can address a single resource by name within a project.
image: ImageSourceHow the container image is obtained: pulled from a registry or built locally from a Dockerfile.
env: HashMap<String, String>Environment variables to inject into the container at startup.
ports: Vec<PortBinding>Host-to-container port bindings to publish.
volumes: Vec<VolumeBinding>Volume and bind-mount mappings to attach.
entrypoint: Option<Vec<String>>Optional override for the image ENTRYPOINT, the executable the
container runs.
A Command::Single string is wrapped as ["sh", "-c", ...];
a Command::Args list is passed through as-is. None leaves the
image entrypoint in place.
command: Option<Vec<String>>Optional command that overrides the image default CMD.
A Command::Single string is wrapped as ["sh", "-c", ...];
a Command::Args list is passed through as-is.
healthcheck: Option<HealthcheckSpec>Optional healthcheck. For postgres and redis, a sensible
default is injected when the manifest omits one.
working_dir: Option<String>Optional working directory override inside the container.
Implementations§
Source§impl ContainerSpec
impl ContainerSpec
Sourcepub fn new(
name: String,
project: String,
resource: String,
image: ImageSource,
) -> Self
pub fn new( name: String, project: String, resource: String, image: ImageSource, ) -> Self
Builds a ContainerSpec with no env, ports, volumes, entrypoint,
command, healthcheck or working directory.
Intended for consumers that synthesize a spec directly rather than
resolving one from a manifest via from_resource. Callers set the
remaining fields as needed.
Trait Implementations§
Source§impl Clone for ContainerSpec
impl Clone for ContainerSpec
Source§fn clone(&self) -> ContainerSpec
fn clone(&self) -> ContainerSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more