Struct docker_api::docker::Docker
source · [−]pub struct Docker { /* private fields */ }
Expand description
Entrypoint interface for communicating with docker daemon
Implementations
sourceimpl Docker
impl Docker
sourcepub async fn version(&self) -> Result<SystemVersion>
pub async fn version(&self) -> Result<SystemVersion>
Returns the version of Docker that is running and various information about the system that Docker is running on.
sourcepub async fn info(&self) -> Result<SystemInfo>
pub async fn info(&self) -> Result<SystemInfo>
Returns system information about Docker instance that is running
sourcepub async fn ping(&self) -> Result<PingInfo>
pub async fn ping(&self) -> Result<PingInfo>
This is a dummy endpoint you can use to test if the server is accessible
sourcepub fn events<'docker>(
&'docker self,
opts: &EventsOpts
) -> impl Stream<Item = Result<EventMessage>> + Unpin + 'docker
pub fn events<'docker>(
&'docker self,
opts: &EventsOpts
) -> impl Stream<Item = Result<EventMessage>> + Unpin + 'docker
Returns a stream of Docker events
sourcepub async fn data_usage(&self) -> Result<SystemDataUsage200Response>
pub async fn data_usage(&self) -> Result<SystemDataUsage200Response>
Returns data usage of this Docker instance
sourceimpl Docker
impl Docker
sourcepub fn new<U>(uri: U) -> Result<Docker> where
U: AsRef<str>,
pub fn new<U>(uri: U) -> Result<Docker> where
U: AsRef<str>,
Creates a new Docker instance by automatically choosing appropriate connection type based
on provided uri
.
Supported schemes are:
unix://
only works when build target isunix
, otherwise returns an Errortcp://
http://
To create a Docker instance utilizing TLS use explicit Docker::tls
constructor (this requires tls
feature enabled).
Uses LATEST_API_VERSION
, to use a specific version see
Docker::new_versioned
.
sourcepub fn new_versioned<U>(uri: U, version: impl Into<ApiVersion>) -> Result<Docker> where
U: AsRef<str>,
pub fn new_versioned<U>(uri: U, version: impl Into<ApiVersion>) -> Result<Docker> where
U: AsRef<str>,
Same as Docker::new
but the API version can be explicitly specified.
sourcepub fn unix<P>(socket_path: P) -> Docker where
P: AsRef<Path>,
Available on Unix only.
pub fn unix<P>(socket_path: P) -> Docker where
P: AsRef<Path>,
Creates a new docker instance for a docker host listening on a given Unix socket.
socket_path
is the part of URI that comes after the unix://
. For example a URI unix:///run/docker.sock
has a
socket_path
== “/run/docker.sock”.
Uses LATEST_API_VERSION
, to use a specific version see
Docker::unix_versioned
.
sourcepub fn unix_versioned<P>(
socket_path: P,
version: impl Into<ApiVersion>
) -> Docker where
P: AsRef<Path>,
Available on Unix only.
pub fn unix_versioned<P>(
socket_path: P,
version: impl Into<ApiVersion>
) -> Docker where
P: AsRef<Path>,
Same as Docker::unix
but the API version can be explicitly specified.
sourcepub fn tls<H, P>(host: H, cert_path: P, verify: bool) -> Result<Docker> where
H: AsRef<str>,
P: AsRef<Path>,
Available on crate feature tls
only.
pub fn tls<H, P>(host: H, cert_path: P, verify: bool) -> Result<Docker> where
H: AsRef<str>,
P: AsRef<Path>,
tls
only.Creates a new docker instance for a docker host listening on a given TCP socket host
.
host
is the part of URI that comes after tcp://
or http://
or https://
schemes,
also known as authority part.
cert_path
specifies the base path in the filesystem containing a certificate (cert.pem
)
and a key (key.pem
) that will be used by the client. If verify is true
a CA file will be
added (ca.pem
) to the connector.
Returns an error if the provided host will fail to parse as URL or reading the certificate files will fail.
Uses LATEST_API_VERSION
, to use a specific version see
Docker::tls_versioned
.
sourcepub fn tls_versioned<H, P>(
host: H,
version: impl Into<ApiVersion>,
cert_path: P,
verify: bool
) -> Result<Docker> where
H: AsRef<str>,
P: AsRef<Path>,
Available on crate feature tls
only.
pub fn tls_versioned<H, P>(
host: H,
version: impl Into<ApiVersion>,
cert_path: P,
verify: bool
) -> Result<Docker> where
H: AsRef<str>,
P: AsRef<Path>,
tls
only.Same as Docker::tls
but the API version can be explicitly specified.
sourcepub fn tcp<H>(host: H) -> Result<Docker> where
H: AsRef<str>,
pub fn tcp<H>(host: H) -> Result<Docker> where
H: AsRef<str>,
Creates a new docker instance for a docker host listening on a given TCP socket host
.
host
is the part of URI that comes after tcp://
or http://
schemes, also known as
authority part.
TLS is supported with feature tls
enabled through Docker::tls constructor.
Returns an error if the provided host will fail to parse as URL.
Uses LATEST_API_VERSION
, to use a specific version see
Docker::tcp_versioned
.
sourcepub fn tcp_versioned<H>(
host: H,
version: impl Into<ApiVersion>
) -> Result<Docker> where
H: AsRef<str>,
pub fn tcp_versioned<H>(
host: H,
version: impl Into<ApiVersion>
) -> Result<Docker> where
H: AsRef<str>,
Same as Docker::tcp
but the API version can be explicitly specified.
sourcepub fn containers(&self) -> Containers
pub fn containers(&self) -> Containers
Exports an interface for interacting with Docker containers
sourcepub async fn adjust_api_version(&mut self) -> Result<()>
pub async fn adjust_api_version(&mut self) -> Result<()>
Verifies the API version returned by the server and adjusts the version used by this client in future requests.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Docker
impl Send for Docker
impl Sync for Docker
impl Unpin for Docker
impl !UnwindSafe for Docker
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more