Container

Struct Container 

Source
pub struct Container<'a, 'b> { /* private fields */ }
Expand description

Interface for accessing and manipulating a docker container

Implementations§

Source§

impl<'a, 'b> Container<'a, 'b>

Source

pub fn new<S>(docker: &'a Docker, id: S) -> Container<'a, 'b>
where S: Into<Cow<'b, str>>,

Exports an interface exposing operations against a container instance

Source

pub fn id(&self) -> &str

a getter for the container id

Source

pub fn inspect(&self) -> impl Future<Item = ContainerDetails, Error = Error>

Inspects the current docker container instance’s details

Source

pub fn top( &self, psargs: Option<&str>, ) -> impl Future<Item = Top, Error = Error>

Returns a top view of information about the container process

Source

pub fn logs( &self, opts: &LogsOptions, ) -> impl Stream<Item = Chunk, Error = Error>

Returns a stream of logs emitted but the container instance

Source

pub fn attach(&self) -> impl Future<Item = Multiplexed, Error = Error>

Attaches to a running container, returning a stream that can be used to interact with the standard IO streams.

Source

pub fn attach_blocking(&self) -> Result<MultiplexedBlocking>

Attaches to a running container, returning a stream that can be used to interact with the standard IO streams.

Source

pub fn changes(&self) -> impl Future<Item = Vec<Change>, Error = Error>

Returns a set of changes made to the container instance

Source

pub fn export(&self) -> impl Stream<Item = Vec<u8>, Error = Error>

Exports the current docker container into a tarball

Source

pub fn stats(&self) -> impl Stream<Item = Stats, Error = Error>

Returns a stream of stats specific to this container instance

Source

pub fn start(&self) -> impl Future<Item = (), Error = Error>

Start the container instance

Source

pub fn stop( &self, wait: Option<Duration>, ) -> impl Future<Item = (), Error = Error>

Stop the container instance

Source

pub fn restart( &self, wait: Option<Duration>, ) -> impl Future<Item = (), Error = Error>

Restart the container instance

Source

pub fn kill( &self, signal: Option<&str>, ) -> impl Future<Item = (), Error = Error>

Kill the container instance

Source

pub fn rename(&self, name: &str) -> impl Future<Item = (), Error = Error>

Rename the container instance

Source

pub fn pause(&self) -> impl Future<Item = (), Error = Error>

Pause the container instance

Source

pub fn unpause(&self) -> impl Future<Item = (), Error = Error>

Unpause the container instance

Source

pub fn wait(&self) -> impl Future<Item = Exit, Error = Error>

Wait until the container stops

Source

pub fn delete(&self) -> impl Future<Item = (), Error = Error>

Delete the container instance

Use remove instead to use the force/v options.

Source

pub fn remove( &self, opts: RmContainerOptions, ) -> impl Future<Item = (), Error = Error>

Delete the container instance (todo: force/v)

Source

pub fn exec( &self, opts: &ExecContainerOptions, ) -> impl Stream<Item = Chunk, Error = Error>

Exec the specified command in the container

Source

pub fn copy_from( &self, path: &Path, ) -> impl Stream<Item = Vec<u8>, Error = Error>

Copy a file/folder from the container. The resulting stream is a tarball of the extracted files.

If path is not an absolute path, it is relative to the container’s root directory. The resource specified by path must exist. To assert that the resource is expected to be a directory, path should end in / or /. (assuming a path separator of /). If path ends in /. then this indicates that only the contents of the path directory should be copied. A symlink is always resolved to its target.

Source

pub fn copy_file_into<P: AsRef<Path>>( &self, path: P, bytes: &[u8], ) -> impl Future<Item = (), Error = Error>

Copy a byte slice as file into (see bytes) the container.

The file will be copied at the given location (see path) and will be owned by root with access mask 644.

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for Container<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for Container<'a, 'b>

§

impl<'a, 'b> Send for Container<'a, 'b>

§

impl<'a, 'b> Sync for Container<'a, 'b>

§

impl<'a, 'b> Unpin for Container<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for Container<'a, 'b>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.