1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

cleanup service containers if php container fails to start

This commit is contained in:
Robin Appelman 2022-08-25 14:39:05 +02:00
commit a658a03043

View file

@ -304,11 +304,29 @@ impl Cloud {
.map(String::from), .map(String::from),
); );
let container = options let container = match options
.php .php
.spawn(docker, &id, env, &options.db, &network, volumes, gateway) .spawn(docker, &id, env, &options.db, &network, volumes, gateway)
.await .await
.wrap_err("Failed to start php container")?; .wrap_err("Failed to start php container")
{
Ok(container) => container,
Err(e) => {
for container in service_containers {
docker
.remove_container(
&container,
Some(RemoveContainerOptions {
force: true,
..RemoveContainerOptions::default()
}),
)
.await
.ok();
}
return Err(e);
}
};
let mut tries = 0; let mut tries = 0;
let ip = loop { let ip = loop {