pub struct DockerSession { /* private fields */ }Expand description
A session representing a working context inside a Docker container.
Commands are executed via docker exec; files are transferred via docker cp.
Implementations§
Source§impl DockerSession
impl DockerSession
Sourcepub fn new(container_id: &str, name: &str) -> Self
pub fn new(container_id: &str, name: &str) -> Self
Create a new session for the given container.
Sourcepub fn set_working_dir(&mut self, dir: impl Into<String>)
pub fn set_working_dir(&mut self, dir: impl Into<String>)
Set the working directory for commands in this session.
Sourcepub fn container_id(&self) -> &str
pub fn container_id(&self) -> &str
Container ID this session is attached to.
Sourcepub async fn exec_command(
&self,
command: &str,
timeout_secs: f64,
check: CheckMode,
) -> Result<BashObservation>
pub async fn exec_command( &self, command: &str, timeout_secs: f64, check: CheckMode, ) -> Result<BashObservation>
Execute a command inside the container via docker exec.
Sourcepub async fn copy_file_in(
&self,
host_path: &str,
container_path: &str,
) -> Result<()>
pub async fn copy_file_in( &self, host_path: &str, container_path: &str, ) -> Result<()>
Copy a file from the host into the container.
Auto Trait Implementations§
impl Freeze for DockerSession
impl RefUnwindSafe for DockerSession
impl Send for DockerSession
impl Sync for DockerSession
impl Unpin for DockerSession
impl UnsafeUnpin for DockerSession
impl UnwindSafe for DockerSession
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
Mutably borrows from an owned value. Read more