[][src]Struct dockworker::Docker

pub struct Docker { /* fields omitted */ }

Handle to connection to the docker daemon

Methods

impl Docker[src]

pub fn set_credential(&mut self, credential: Credential)[src]

pub fn connect_with_defaults() -> Result<Docker>[src]

Connect to the Docker daemon

Summary

Connect to the Docker daemon using the standard Docker configuration options. This includes:

  • DOCKER_HOST
  • DOCKER_TLS_VERIFY
  • DOCKER_CERT_PATH
  • DOCKER_CONFIG

and we try to interpret these as much like the standard docker client as possible.

pub fn connect_with_unix(addr: &str) -> Result<Docker>[src]

This ensures that using a fully-qualified path

e.g. unix://.... -- works. The unix socket provider expects a Path, so we don't need scheme.

pub fn connect_with_ssl(
    _addr: &str,
    _key: &Path,
    _cert: &Path,
    _ca: &Path
) -> Result<Docker>
[src]

pub fn connect_with_http(addr: &str) -> Result<Docker>[src]

Connect using unsecured HTTP. This is strongly discouraged everywhere but on Windows when npipe support is not available.

pub fn list_containers(
    &self,
    all: Option<bool>,
    limit: Option<u64>,
    size: Option<bool>,
    filters: ContainerFilters
) -> Result<Vec<Container>>
[src]

List containers

API

/containers/json

pub fn containers(&self, opts: ContainerListOptions) -> Result<Vec<Container>>[src]

Deprecated

pub fn create_container(
    &self,
    name: Option<&str>,
    option: &ContainerCreateOptions
) -> Result<CreateContainerResponse>
[src]

Create a container

Summary

  • name - None: auto naming
  • option - create options

API

POST /containers/create?{name}

pub fn start_container(&self, id: &str) -> Result<()>[src]

Start a container

API

/containers/{id}/start

pub fn stop_container(&self, id: &str, timeout: Duration) -> Result<()>[src]

Stop a container

API

/containers/{id}/stop

pub fn kill_container(&self, id: &str, signal: Signal) -> Result<()>[src]

Kill a container

API

/containers/{id}/kill

pub fn restart_container(&self, id: &str, timeout: Duration) -> Result<()>[src]

Restart a container

API

/containers/{id}/restart

pub fn attach_container(
    &self,
    id: &str,
    detachKeys: Option<&str>,
    logs: bool,
    stream: bool,
    stdin: bool,
    stdout: bool,
    stderr: bool
) -> Result<AttachResponse>
[src]

Attach to a container

Attach to a container to read its output or send it input.

API

/containers/{id}/attach

pub fn exec_container(
    &self,
    id: &str,
    option: &CreateExecOptions
) -> Result<CreateExecResponse>
[src]

Create Exec instance for a container

Run a command inside a running container.

API

/containers/{id}/exec

pub fn start_exec(
    &self,
    id: &str,
    option: &StartExecOptions
) -> Result<AttachResponse>
[src]

Start an exec instance

Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.

API

/exec/{id}/start

pub fn exec_inspect(&self, id: &str) -> Result<ExecInfo>[src]

Inspect an exec instance

Return low-level information about an exec instance.

API

/exec/{id}/json

pub fn log_container(
    &self,
    id: &str,
    option: &ContainerLogOptions
) -> Result<LogResponse>
[src]

Gets current logs and tails logs from a container

API

/containers/{id}/logs

pub fn container_top(&self, container: &Container) -> Result<Top>[src]

List processes running inside a container

API

/containers/{id}/top

pub fn processes(&self, container: &Container) -> Result<Vec<Process>>[src]

pub fn stats(&self, container: &Container) -> Result<StatsReader>[src]

Get containers stats based resource usage

API

/containers/{id}/stats

pub fn wait_container(&self, id: &str) -> Result<ExitStatus>[src]

Wait for a container

API

/containers/{id}/wait

pub fn remove_container(
    &self,
    id: &str,
    volume: Option<bool>,
    force: Option<bool>,
    link: Option<bool>
) -> Result<()>
[src]

Remove a container

API

/containers/{id}

pub fn get_file(&self, id: &str, path: &Path) -> Result<Archive<Box<dyn Read>>>[src]

Get an archive of a filesystem resource in a container

API

/containers/{id}/archive

pub fn put_file(
    &self,
    id: &str,
    src: &Path,
    dst: &Path,
    noOverwriteDirNonDir: bool
) -> Result<()>
[src]

Extract an archive of files or folders to a directory in a container

Summary

Extract given src file into the container specified with id. The input file must be a tar archive with id(no compress), gzip, bzip2 or xz.

  • id : container name or ID
  • src : path to a source file
  • dst : path to a directory in the container to extract the archive's contents into

API

/containers/{id}/archive

pub fn build_image(
    &self,
    options: ContainerBuildOptions,
    tar_path: &Path
) -> Result<Response>
[src]

Build an image from a tar archive with a Dockerfile in it.

API

/build?

pub fn create_image(
    &self,
    image: &str,
    tag: &str
) -> Result<Box<dyn Iterator<Item = Result<DockerResponse>>>>
[src]

Create an image by pulling it from registry

API

/images/create?fromImage={image}&tag={tag}

NOTE

When control returns from this function, creating job may not have been completed. For waiting the completion of the job, consuming response like create_image("hello-world", "linux").map(|r| r.for_each(|_| ()));.

TODO

  • Typing result iterator like image::ImageStatus.
  • Generalize input parameters

pub fn inspect_image(&self, name: &str) -> Result<Image>[src]

Inspect an image

API

/images/{name}/json

pub fn push_image(&self, name: &str, tag: &str) -> Result<()>[src]

Push an image

NOTE

For pushing an image to non default registry, add registry id to prefix of the image name like <registry>/<image> . But the name of the local cache image is <image>:<tag> .

API

/images/{name}/push

pub fn remove_image(
    &self,
    name: &str,
    force: Option<bool>,
    noprune: Option<bool>
) -> Result<Vec<RemovedImage>>
[src]

Remove an image

API

/images/{name}

pub fn prune_image(&self, dangling: bool) -> Result<PrunedImages>[src]

Delete unused images

API

/images/prune

pub fn history_image(&self, name: &str) -> Result<Vec<ImageLayer>>[src]

History of an image

API

/images/{name}/history

pub fn images(&self, all: bool) -> Result<Vec<SummaryImage>>[src]

List images

API

/images/json

pub fn export_image(&self, name: &str) -> Result<Box<dyn Read>>[src]

Get a tarball containing all images and metadata for a repository

API

/images/{name}/get

pub fn load_image(&self, quiet: bool, path: &Path) -> Result<ImageId>[src]

Import images

Summary

Load a set of images and tags into a repository

API

/images/load

pub fn auth(
    &self,
    username: &str,
    password: &str,
    email: &str,
    serveraddress: &str
) -> Result<AuthToken>
[src]

Check auth configuration

API

/auth

NOTE

In some cases, docker daemon returns an empty token with 200 Ok. The empty token could not be used for authenticating users.

pub fn system_info(&self) -> Result<SystemInfo>[src]

Get system information

API

/info

pub fn container_info(&self, container: &Container) -> Result<ContainerInfo>[src]

Inspect about a container

API

/containers/{id}/json

pub fn filesystem_changes(
    &self,
    container: &Container
) -> Result<Vec<FilesystemChange>>
[src]

Get changes on a container's filesystem.

(This is the same as docker container diff command.)

API

/containers/{id}/changes

pub fn export_container(&self, container: &Container) -> Result<Box<dyn Read>>[src]

Export a container

Summary

Returns a pointer to tar archive stream.

API

/containers/{id}/export

pub fn ping(&self) -> Result<()>[src]

Test if the server is accessible

API

/_ping

pub fn version(&self) -> Result<Version>[src]

Get version and various information

API

/version

pub fn events(
    &self,
    since: Option<u64>,
    until: Option<u64>,
    filters: Option<EventFilters>
) -> Result<Box<dyn Iterator<Item = Result<EventResponse>>>>
[src]

Get monitor events

API

/events

Trait Implementations

impl Debug for Docker[src]

Auto Trait Implementations

impl Send for Docker

impl !Sync for Docker

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T