This commit is contained in:
2025-04-05 07:23:07 +02:00
parent 6de7bf9b56
commit 6d4c1742e7
14 changed files with 533 additions and 455 deletions

View File

@@ -3,6 +3,7 @@
use std::collections::HashMap;
use crate::virt::nerdctl::{execute_nerdctl_command, NerdctlError};
use super::container_types::{Container, HealthCheck};
use super::health_check_script::prepare_health_check_command;
impl Container {
/// Add a port mapping
@@ -220,8 +221,11 @@ impl Container {
///
/// * `Self` - The container instance for method chaining
pub fn with_health_check(mut self, cmd: &str) -> Self {
// Use the health check script module to prepare the command
let prepared_cmd = prepare_health_check_command(cmd, &self.name);
self.health_check = Some(HealthCheck {
cmd: cmd.to_string(),
cmd: prepared_cmd,
interval: None,
timeout: None,
retries: None,
@@ -251,8 +255,11 @@ impl Container {
retries: Option<u32>,
start_period: Option<&str>,
) -> Self {
// Use the health check script module to prepare the command
let prepared_cmd = prepare_health_check_command(cmd, &self.name);
let mut health_check = HealthCheck {
cmd: cmd.to_string(),
cmd: prepared_cmd,
interval: None,
timeout: None,
retries: None,