pub struct DockerDebugInfo {
pub all_containers: Result<String, String>,
pub ssh_images: Result<String, String>,
pub ssh_containers: Result<Vec<ContainerInfo>, String>,
pub port_usage: Result<Vec<String>, String>,
/* private fields */
}Expand description
Debug information collected about Docker containers
This struct holds structured information about Docker state for troubleshooting SSH server container issues. Each field contains either successfully collected data or an error message explaining what went wrong.
Fields§
§all_containers: Result<String, String>Output from docker ps -a listing all containers
ssh_images: Result<String, String>Docker images matching the SSH server image name
ssh_containers: Result<Vec<ContainerInfo>, String>Information about containers using the SSH server image
port_usage: Result<Vec<String>, String>Port usage information for the SSH port
Implementations§
Source§impl DockerDebugInfo
impl DockerDebugInfo
Sourcepub fn new(
docker: Arc<DockerClient>,
container_port: u16,
image_name: &str,
image_tag: &str,
) -> Self
pub fn new( docker: Arc<DockerClient>, container_port: u16, image_name: &str, image_tag: &str, ) -> Self
Create a new DockerDebugInfo and collect all diagnostic information
This constructor runs various Docker commands to gather diagnostic information when SSH connectivity tests fail. It collects container status, logs, and port usage information.
§Arguments
docker- Docker client for executing commandscontainer_port- The host port that the SSH container is mapped toimage_name- Image name to filter by (e.g., “torrust-ssh-server”)image_tag- Image tag to filter by (e.g., “latest”)
§Returns
A DockerDebugInfo struct containing all collected information. Each field
is a Result that either contains the successfully collected data or an
error message explaining what went wrong.
§Example
use std::sync::Arc;
use torrust_tracker_deployer_lib::adapters::docker::DockerClient;
use torrust_tracker_deployer_lib::testing::integration::ssh_server::DockerDebugInfo;
let docker = Arc::new(DockerClient::new());
let debug_info = DockerDebugInfo::new(docker, 2222, "torrust-ssh-server", "latest");
debug_info.print();Sourcepub fn docker(&self) -> &Arc<DockerClient> ⓘ
pub fn docker(&self) -> &Arc<DockerClient> ⓘ
Get a reference to the Docker client
This allows access to the underlying Docker client for additional operations if needed after debug info has been collected.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DockerDebugInfo
impl RefUnwindSafe for DockerDebugInfo
impl Send for DockerDebugInfo
impl Sync for DockerDebugInfo
impl Unpin for DockerDebugInfo
impl UnsafeUnpin for DockerDebugInfo
impl UnwindSafe for DockerDebugInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request