cli 0.1.11 fix docker run. dont fail when there is no existing container

This commit is contained in:
mbecker20
2023-01-12 00:24:41 +00:00
parent 34a6ac3be3
commit 511efdc113
3 changed files with 16 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -1472,7 +1472,7 @@ dependencies = [
[[package]]
name = "monitor_cli"
version = "0.1.10"
version = "0.1.11"
dependencies = [
"async_timing_util",
"clap",

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_cli"
version = "0.1.10"
version = "0.1.11"
edition = "2021"
authors = ["MoghTech"]
description = "monitor cli | tools to setup monitor system"

View File

@@ -246,7 +246,13 @@ pub fn start_core(sub_matches: &ArgMatches) {
}
}
let command = format!("docker stop {name} && docker container rm {name} && docker pull {CORE_IMAGE_NAME} && docker run -d --name {name} -p {port}:9000 --network {network} -v {config_path}:/config/config.toml --restart {restart} --add-host host.docker.internal:host-gateway {CORE_IMAGE_NAME}");
println!("\nstarting monitor core container...\n");
let _ = run_command_pipe_to_terminal(&format!("docker pull {CORE_IMAGE_NAME}"));
let _ = run_command_pipe_to_terminal(&format!("docker stop {name} && docker container rm {name}"));
let command = format!("docker run -d --name {name} -p {port}:9000 --network {network} -v {config_path}:/config/config.toml --restart {restart} --add-host host.docker.internal:host-gateway {CORE_IMAGE_NAME}");
let output = run_command_pipe_to_terminal(&command);
@@ -519,7 +525,13 @@ pub fn start_periphery_container(sub_matches: &ArgMatches) {
}
}
let command = format!("docker stop {name} && docker container rm {name} && docker pull {PERIPHERY_IMAGE_NAME} && docker run -d --name {name} -p {port}:8000 --network {network} -v {config_path}:/config/config.toml -v {repo_dir}:/repos -v /var/run/docker.sock:/var/run/docker.sock --restart {restart} {PERIPHERY_IMAGE_NAME}");
println!("\nstarting monitor periphery container...\n");
let _ = run_command_pipe_to_terminal(&format!("docker pull {PERIPHERY_IMAGE_NAME}"));
let _ = run_command_pipe_to_terminal(&format!("docker stop {name} && docker container rm {name}"));
let command = format!("docker run -d --name {name} -p {port}:8000 --network {network} -v {config_path}:/config/config.toml -v {repo_dir}:/repos -v /var/run/docker.sock:/var/run/docker.sock --restart {restart} {PERIPHERY_IMAGE_NAME}");
let output = run_command_pipe_to_terminal(&command);