opendut
opendut copied to clipboard
Executor Container needs to be started with `--detach`
In principle, we want roughly this change to be made:
let engine = match engine {
Engine::Docker => { "docker" }
Engine::Podman => { "podman" }
};
let mut cmd = Command::new(engine);
cmd.arg("run");
+ cmd.arg("--detach");
cmd.arg("--restart=unless-stopped");
if let ContainerName::Value(name) = name {
cmd.args(["--name", name.as_str()]);
}
for port in ports {
cmd.args(["--publish", port.value()]);
}
for volume in volumes {
cmd.args(["--volume", volume.value()]);
}
for device in devices {
cmd.args(["--devices", device.value()]);
}
for env in envs {
cmd.args(["--env", &format!("{}={}", env.name(), env.value())]);
}
cmd.arg(image.value());
if let ContainerCommand::Value(command) = command {
cmd.arg(command.as_str());
}
for arg in args {
cmd.arg(arg.value());
}
debug!("Command: {:?}", cmd);
- match cmd.spawn() {
+ match cmd.output().await {
Ok(_) => { info!("Container started.") }
Err(_) => { error!("Failed to start container.") }
};
The change needs to be made here:
https://github.com/eclipse-opendut/opendut/blob/b97b3f5a4e711857beb56d30441defecccb00d58/opendut-edgar/src/service/start.rs#L205-L238
However, this needs to be tested. We should also take the command output and include it into the log statement after the command was started.