pub struct Container<'docker> { /* private fields */ }
Expand description
Interface for accessing and manipulating a docker container
Implementations§
Source§impl<'docker> Container<'docker>
impl<'docker> Container<'docker>
Sourcepub fn new<S>(docker: &'docker Docker, id: S) -> Self
pub fn new<S>(docker: &'docker Docker, id: S) -> Self
Exports an interface exposing operations against a container instance
Sourcepub async fn inspect(&self) -> Result<ContainerDetails>
pub async fn inspect(&self) -> Result<ContainerDetails>
Inspects the current docker container instance’s details
Sourcepub async fn top(&self, psargs: Option<&str>) -> Result<Top>
pub async fn top(&self, psargs: Option<&str>) -> Result<Top>
Returns a top
view of information about the container process
Sourcepub fn logs(
&self,
opts: &LogsOptions,
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
pub fn logs( &self, opts: &LogsOptions, ) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
Returns a stream of logs emitted but the container instance
Sourcepub async fn attach(&self) -> Result<TtyMultiPlexer<'docker>>
pub async fn attach(&self) -> Result<TtyMultiPlexer<'docker>>
Attaches a Multiplexer to the container.
The Multiplexer implements Stream for returning Stdout and
Stderr chunks. It also implements [AsyncWrite]
for writing to Stdin.
The multiplexer can be split into its read and write halves with the split method
Sourcepub async fn changes(&self) -> Result<Vec<Change>>
pub async fn changes(&self) -> Result<Vec<Change>>
Returns a set of changes made to the container instance
Sourcepub fn export(&self) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
pub fn export(&self) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
Exports the current docker container into a tarball
Sourcepub fn stats(&self) -> impl Stream<Item = Result<Stats>> + Unpin + 'docker
pub fn stats(&self) -> impl Stream<Item = Result<Stats>> + Unpin + 'docker
Returns a stream of stats specific to this container instance
Sourcepub async fn restart(&self, wait: Option<Duration>) -> Result<()>
pub async fn restart(&self, wait: Option<Duration>) -> Result<()>
Restart the container instance
Sourcepub async fn remove(&self, opts: RmContainerOptions) -> Result<()>
pub async fn remove(&self, opts: RmContainerOptions) -> Result<()>
Delete the container instance (todo: force/v)
Sourcepub fn exec(
&self,
opts: &ExecContainerOptions,
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
pub fn exec( &self, opts: &ExecContainerOptions, ) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
Execute a command in this container
Sourcepub fn copy_from(
&self,
path: &Path,
) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
pub fn copy_from( &self, path: &Path, ) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
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.