MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / is_proxy_running

Method is_proxy_running

src/docker/proxy_manager.rs:375–389  ·  view source on GitHub ↗

Checks if the specified proxy container is currently running.

(&self, container_name: &str)

Source from the content-addressed store, hash-verified

373
374 /// Checks if the specified proxy container is currently running.
375 pub async fn is_proxy_running(&self, container_name: &str) -> Result<bool> {
376 match self.docker_client.inspect_container(container_name).await {
377 Ok(json_data) => {
378 let data: serde_json::Value = serde_json::from_str(&json_data)
379 .map_err(|e| anyhow::anyhow!("Failed to parse container info: {e}"))?;
380 Ok(data
381 .get("State")
382 .and_then(|s| s.get("Running"))
383 .and_then(|r| r.as_bool())
384 .unwrap_or(false))
385 }
386 Err(e) if e.to_lowercase().contains("no such container") => Ok(false),
387 Err(e) => Err(anyhow::anyhow!(e)),
388 }
389 }
390
391 /// Counts the number of agent networks the specified proxy is connected to.
392 ///

Callers 5

ensure_proxyMethod · 0.80
force_stop_proxyMethod · 0.80

Calls 1

inspect_containerMethod · 0.45

Tested by 2