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:
parent
36fcc3aa9e
commit
a658a03043
1 changed files with 20 additions and 2 deletions
22
src/cloud.rs
22
src/cloud.rs
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue