pub struct DockerClient { /* private fields */ }
Expand description
A structure defining a Client to interact with the docker API
- unix_socket: UnixStream connection for docker socket.
- protocol: Underlying protocol we are using(UNIX by default.)
Implementations§
Source§impl DockerClient
impl DockerClient
Sourcepub fn new(
connection_addr: &'static str,
) -> Result<DockerClient, DockerClientError>
pub fn new( connection_addr: &'static str, ) -> Result<DockerClient, DockerClientError>
Creates a new DockerClient object connected to docker’s unix domain socket.
Trait Implementations§
Source§impl Clone for DockerClient
Implement clone for the DockerClient structure.
The clone here is not true clone, the unix_socket cloned
still refers to the stream and change to one of the two will
propogate the changes to other.
impl Clone for DockerClient
Implement clone for the DockerClient structure. The clone here is not true clone, the unix_socket cloned still refers to the stream and change to one of the two will propogate the changes to other.
Source§fn clone(&self) -> DockerClient
fn clone(&self) -> DockerClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Containers for DockerClient
impl Containers for DockerClient
Source§fn get_response_from_api(
&self,
api_endpoint: &str,
method: &str,
body: &str,
) -> Result<Response, String>
fn get_response_from_api( &self, api_endpoint: &str, method: &str, body: &str, ) -> Result<Response, String>
Just a helper function for the Containers DockerApiClient.
It formats the API request using the given parameters, and using
this request the docker daemon and sends back the response of the request
if the request was successful else an err.
Source§fn get_containers(
&self,
api_endpoint: &str,
method: &str,
query_param: &str,
) -> Result<Vec<Container>, String>
fn get_containers( &self, api_endpoint: &str, method: &str, query_param: &str, ) -> Result<Vec<Container>, String>
Get Containers from the API endpoint with the method and query_param.
Helper function for Container trait.
Source§fn list_running_containers(
&self,
limit: Option<u32>,
) -> Result<Vec<Container>, String>
fn list_running_containers( &self, limit: Option<u32>, ) -> Result<Vec<Container>, String>
List all the running containers
Return an instance of Vector of container Read more
Source§fn list_all_containers(
&self,
limit: Option<u32>,
) -> Result<Vec<Container>, String>
fn list_all_containers( &self, limit: Option<u32>, ) -> Result<Vec<Container>, String>
List all containers whether running or stopped.
Source§fn get_container_details_with_filter(
&self,
filter: &str,
limit: Option<u32>,
) -> Result<Vec<Container>, String>
fn get_container_details_with_filter( &self, filter: &str, limit: Option<u32>, ) -> Result<Vec<Container>, String>
List container with the filter provided, the filter can be looked from
Docker engine official API documentation.
https://docs.docker.com/engine/api/v1.37/#operation/ContainerList
Source§fn create_container(
&self,
name: &str,
config: ContainerConfig,
) -> Result<CreateContainerResponse, String>
fn create_container( &self, name: &str, config: ContainerConfig, ) -> Result<CreateContainerResponse, String>
Create a container from the ContainerConfig structure with the provided
name
. The response for the request is the CreateContaierResponse struct
which contains the ID for the container which we created.Source§fn create_container_minimal(
&self,
name: &str,
image: &str,
cmd: Vec<String>,
) -> Result<CreateContainerResponse, String>
fn create_container_minimal( &self, name: &str, image: &str, cmd: Vec<String>, ) -> Result<CreateContainerResponse, String>
Creates/Spawn docker container from the configuration provided. It only Read more
Source§fn inspect_container(&self, id: &str) -> Result<ContainerDetails, String>
fn inspect_container(&self, id: &str) -> Result<ContainerDetails, String>
Inspects the container with the provided ID
Returns Low level information about the container. Read more
Source§fn get_container_filesystem_changes(
&self,
id: &str,
) -> Result<Vec<ContainerFsChange>, String>
fn get_container_filesystem_changes( &self, id: &str, ) -> Result<Vec<ContainerFsChange>, String>
Gives the changes done to somewhere in the filesystem in the docker container as a list of
files with the kind of changes.
Source§fn manipulate_container_status(
&self,
action: &str,
id: &str,
params: &str,
) -> Result<String, String>
fn manipulate_container_status( &self, action: &str, id: &str, params: &str, ) -> Result<String, String>
Function to manipulate container status
It is a parent function for all the commands which result in a status change
of the container. Read more
fn start_container(&self, id: &str) -> Result<String, String>
fn stop_container( &self, id: &str, delay: Option<&str>, ) -> Result<String, String>
fn pause_container(&self, id: &str) -> Result<String, String>
fn unpause_container(&self, id: &str) -> Result<String, String>
fn restart_container( &self, id: &str, delay: Option<&str>, ) -> Result<String, String>
fn kill_container( &self, id: &str, signal: Option<&str>, ) -> Result<String, String>
fn rename_container(&self, id: &str, name: &str) -> Result<String, String>
Source§impl DockerApiClient for DockerClient
impl DockerApiClient for DockerClient
Auto Trait Implementations§
impl Freeze for DockerClient
impl RefUnwindSafe for DockerClient
impl Send for DockerClient
impl Sync for DockerClient
impl Unpin for DockerClient
impl UnwindSafe for DockerClient
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