pub struct ServiceConfig {Show 23 fields
pub image: Option<String>,
pub entrypoint: Option<StringOrList>,
pub command: Option<StringOrList>,
pub environment: EnvVars,
pub env_file: StringOrList,
pub secret_environment: HashMap<String, String>,
pub ports: Vec<String>,
pub volumes: Vec<String>,
pub depends_on: DependsOn,
pub networks: ServiceNetworks,
pub cpus: Option<u32>,
pub mem_limit: Option<String>,
pub restart: Option<String>,
pub dns: DnsConfig,
pub tmpfs: StringOrList,
pub cap_add: Vec<String>,
pub cap_drop: Vec<String>,
pub privileged: bool,
pub labels: Labels,
pub healthcheck: Option<HealthcheckConfig>,
pub working_dir: Option<String>,
pub hostname: Option<String>,
pub extra_hosts: StringOrList,
}Expand description
A single service in a compose file.
Fields§
§image: Option<String>OCI image reference (e.g., “nginx:latest”).
entrypoint: Option<StringOrList>Override the container entrypoint.
command: Option<StringOrList>Override the container command.
environment: EnvVarsEnvironment variables.
env_file: StringOrListEnvironment files to load before environment overrides.
secret_environment: HashMap<String, String>Transient environment bindings keyed by guest variable name, with values naming process-environment variables owned by the caller. Secret bytes are never part of this configuration model.
ports: Vec<String>Port mappings (“host:container”).
volumes: Vec<String>Volume mounts (“name:/path” or “/host:/container”).
depends_on: DependsOnServices this service depends on (started first).
networks: ServiceNetworksNetworks to connect to.
cpus: Option<u32>Number of CPUs.
mem_limit: Option<String>Memory limit (e.g., “512m”, “1g”).
restart: Option<String>Restart policy: “no”, “always”, “on-failure”, “unless-stopped”.
dns: DnsConfigCustom DNS servers.
tmpfs: StringOrListtmpfs mounts.
cap_add: Vec<String>Linux capabilities to add.
cap_drop: Vec<String>Linux capabilities to drop.
privileged: boolPrivileged mode.
labels: LabelsCustom labels.
healthcheck: Option<HealthcheckConfig>Health check configuration.
working_dir: Option<String>Working directory inside the container.
hostname: Option<String>Hostname inside the container.
extra_hosts: StringOrListStatic host entries (HOST:IP).
Trait Implementations§
Source§impl Clone for ServiceConfig
impl Clone for ServiceConfig
Source§fn clone(&self) -> ServiceConfig
fn clone(&self) -> ServiceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more