diff --git a/backend/src/context/rpc.rs b/backend/src/context/rpc.rs index 2247674ae..9dcd53dc9 100644 --- a/backend/src/context/rpc.rs +++ b/backend/src/context/rpc.rs @@ -4,6 +4,7 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::time::Duration; use bollard::Docker; use helpers::to_tmp_path; @@ -212,7 +213,8 @@ impl RpcContext { tracing::info!("Opened Pg DB"); let db = base.db(&secret_store).await?; tracing::info!("Opened PatchDB"); - let docker = Docker::connect_with_unix_defaults()?; + let mut docker = Docker::connect_with_unix_defaults()?; + docker.set_timeout(Duration::from_secs(600)); tracing::info!("Connected to Docker"); let net_controller = NetController::init( ([127, 0, 0, 1], 80).into(), diff --git a/backend/src/install/cleanup.rs b/backend/src/install/cleanup.rs index 8d4301fce..1c9cc1bb0 100644 --- a/backend/src/install/cleanup.rs +++ b/backend/src/install/cleanup.rs @@ -119,10 +119,20 @@ pub async fn cleanup(ctx: &RpcContext, id: &PackageId, version: &Version) -> Res .await .apply(|res| errors.handle(res)); errors.extend( - futures::future::join_all(images.into_iter().flatten().map(|image| async { - let image = image; // move into future - ctx.docker.remove_image(&image.id, None, None).await - })) + futures::future::join_all( + images + .into_iter() + .flatten() + .flat_map(|image| image.repo_tags) + .filter(|tag| { + tag.starts_with(&format!("start9/{}/", id)) + && tag.ends_with(&format!(":{}", version)) + }) + .map(|tag| async { + let tag = tag; // move into future + ctx.docker.remove_image(&tag, None, None).await + }), + ) .await, ); let pkg_archive_dir = ctx