pub struct Docker { /* private fields */ }Expand description
The local Docker Engine.
Implementations§
Source§impl Docker
impl Docker
Sourcepub fn connect() -> Result<Docker, Error>
pub fn connect() -> Result<Docker, Error>
Connects to the Docker Engine at DOCKER_HOST, or its local socket. Only unix:// hosts are supported.
Sourcepub async fn info(&self) -> Result<SystemInfo, Error>
pub async fn info(&self) -> Result<SystemInfo, Error>
The Engine’s system information.
Trait Implementations§
Source§impl DockerApi for Docker
impl DockerApi for Docker
Source§async fn start(
&self,
spec: &RunnerSpec,
isolation: &dyn Isolation,
) -> Result<String, Error>
async fn start( &self, spec: &RunnerSpec, isolation: &dyn Isolation, ) -> Result<String, Error>
Creates and starts a runner container; returns its ID.
Source§async fn inspect(&self, container: &str) -> Result<RunnerState, Error>
async fn inspect(&self, container: &str) -> Result<RunnerState, Error>
A container’s state and isolation.
Source§async fn remove(&self, container: &str) -> Result<(), Error>
async fn remove(&self, container: &str) -> Result<(), Error>
Removes a runner container, stopping it first if it runs.
Source§async fn run(
&self,
name: &str,
body: ContainerCreateBody,
) -> Result<String, Error>
async fn run( &self, name: &str, body: ContainerCreateBody, ) -> Result<String, Error>
Creates and starts a container that is not a runner, such as the mirror; returns its ID.
Source§async fn list(&self, label: &str) -> Result<Vec<Container>, Error>
async fn list(&self, label: &str) -> Result<Vec<Container>, Error>
Every container, running or not, that has the label.
Source§async fn wait(&self, container: &str) -> Result<i64, Error>
async fn wait(&self, container: &str) -> Result<i64, Error>
Waits for a container to exit; returns its exit code.
Source§async fn logs(&self, container: &str) -> Result<String, Error>
async fn logs(&self, container: &str) -> Result<String, Error>
A container’s output so far, stdout and stderr interleaved.
Source§async fn logs_since(&self, container: &str, since: u64) -> Result<String, Error>
async fn logs_since(&self, container: &str, since: u64) -> Result<String, Error>
A container’s output since
since (seconds since the epoch), each line prefixed with Docker’s RFC 3339
timestamp and a space.Source§async fn exec(
&self,
container: &str,
command: Vec<String>,
) -> Result<Output, Error>
async fn exec( &self, container: &str, command: Vec<String>, ) -> Result<Output, Error>
Runs a command as root in a running container; its stdout streams until it exits or the container stops.
Its stderr is dropped.
Source§async fn image_present(&self, image: &str) -> Result<bool, Error>
async fn image_present(&self, image: &str) -> Result<bool, Error>
Whether Docker has an image.
Source§async fn pull(&self, image: &str) -> Result<(), Error>
async fn pull(&self, image: &str) -> Result<(), Error>
Pulls an image, logging its progress every few seconds.
Source§async fn ensure_network(&self, name: &str) -> Result<(), Error>
async fn ensure_network(&self, name: &str) -> Result<(), Error>
Creates a bridge network unless it exists.
Source§async fn ensure_volume(&self, name: &str) -> Result<(), Error>
async fn ensure_volume(&self, name: &str) -> Result<(), Error>
Creates a volume unless it exists.
Source§async fn remove_volume(&self, name: &str) -> Result<(), Error>
async fn remove_volume(&self, name: &str) -> Result<(), Error>
Removes a volume; a volume that does not exist is not an error.
Source§async fn volume_sizes(&self) -> Result<BTreeMap<String, u64>, Error>
async fn volume_sizes(&self) -> Result<BTreeMap<String, u64>, Error>
The disk size of every volume Docker knows, by name. Slow: Docker measures each volume.
Source§async fn changes(&self, container: &str) -> Result<Vec<String>, Error>
async fn changes(&self, container: &str) -> Result<Vec<String>, Error>
The paths a container’s own layer added or changed, not those it deleted.
Source§async fn written(&self, container: &str) -> Result<u64, Error>
async fn written(&self, container: &str) -> Result<u64, Error>
The bytes a container’s own layer holds.
Source§async fn commit(
&self,
container: &str,
reference: &str,
labels: BTreeMap<String, String>,
) -> Result<u64, Error>
async fn commit( &self, container: &str, reference: &str, labels: BTreeMap<String, String>, ) -> Result<u64, Error>
Commits a stopped container’s own layer as the image
reference (repository:tag) with labels; returns
the disk the image takes beyond its parent.Source§async fn image_id(&self, reference: &str) -> Result<Option<String>, Error>
async fn image_id(&self, reference: &str) -> Result<Option<String>, Error>
The ID of the image a reference (tag, digest or ID) names;
None when Docker does not have it.Source§async fn tagged_images(&self) -> Result<Vec<TaggedImage>, Error>
async fn tagged_images(&self) -> Result<Vec<TaggedImage>, Error>
Every image Docker has a tag for.
Source§async fn container_images(&self) -> Result<BTreeSet<String>, Error>
async fn container_images(&self) -> Result<BTreeSet<String>, Error>
The image ID of every container, running or stopped.
Source§async fn remove_image(&self, reference: &str) -> Result<(), Error>
async fn remove_image(&self, reference: &str) -> Result<(), Error>
Removes an image and the layers only it used; one that does not exist is not an error.
Auto Trait Implementations§
impl !RefUnwindSafe for Docker
impl !UnwindSafe for Docker
impl Freeze for Docker
impl Send for Docker
impl Sync for Docker
impl Unpin for Docker
impl UnsafeUnpin for Docker
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