From a984a623920677ed8fb2085c8952afd04547ecd5 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Wed, 26 Jan 2022 16:11:45 -0700 Subject: [PATCH] forcefully remove the container, blowing past 409s --- backend/src/action/docker.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/src/action/docker.rs b/backend/src/action/docker.rs index f24ab36c3..d6f4ba99f 100644 --- a/backend/src/action/docker.rs +++ b/backend/src/action/docker.rs @@ -5,6 +5,7 @@ use std::net::Ipv4Addr; use std::path::PathBuf; use std::time::Duration; +use bollard::container::RemoveContainerOptions; use futures::future::Either as EitherFuture; use nix::sys::signal; use nix::unistd::Pid; @@ -68,7 +69,18 @@ impl DockerAction { .arg(&container_name) .arg(format!("--hostname={}", &container_name)) .arg("--no-healthcheck"); - match ctx.docker.remove_container(&container_name, None).await { + match ctx + .docker + .remove_container( + &container_name, + Some(RemoveContainerOptions { + v: false, + force: true, + link: false, + }), + ) + .await + { Ok(()) | Err(bollard::errors::Error::DockerResponseNotFoundError { .. }) => Ok(()), Err(e) => Err(e), }?;