Struct moby::container::Container [−][src]
Interface for accessing and manipulating a docker container
Api Reference: https://docs.docker.com/engine/api/v1.41/#tag/Container
Implementations
impl<'docker> Container<'docker>
[src]
pub fn new<S>(docker: &'docker Docker, id: S) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Exports an interface exposing operations against a container instance
pub fn id(&self) -> &str
[src]
a getter for the container id
pub async fn inspect(&self) -> Result<ContainerDetails>
[src]
Inspects the current docker container instance’s details
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerInspect
pub async fn top(&self, psargs: Option<&str>) -> Result<Top>
[src]
Returns a top
view of information about the container process
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerTop
pub fn logs(
&self,
opts: &LogsOptions
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
[src]
&self,
opts: &LogsOptions
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
Returns a stream of logs emitted but the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerLogs
pub async fn attach(&self) -> Result<TtyMultiPlexer<'docker>>
[src]
Attaches a [TtyMultiplexer]
to the container.
The [TtyMultiplexer]
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](TtyMultiplexer::split)
method
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerAttach
pub async fn changes(&self) -> Result<Vec<Change>>
[src]
Returns a set of changes made to the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerChanges
pub fn export(&self) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
[src]
Exports the current docker container into a tarball
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerExport
pub fn stats(&self) -> impl Stream<Item = Result<Stats>> + Unpin + 'docker
[src]
Returns a stream of stats specific to this container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerStats
pub async fn start(&self) -> Result<()>
[src]
Start the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerStart
pub async fn stop(&self, wait: Option<Duration>) -> Result<()>
[src]
Stop the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerStop
pub async fn restart(&self, wait: Option<Duration>) -> Result<()>
[src]
Restart the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerRestart
pub async fn kill(&self, signal: Option<&str>) -> Result<()>
[src]
Kill the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerKill
pub async fn rename(&self, name: &str) -> Result<()>
[src]
Rename the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerRename
pub async fn pause(&self) -> Result<()>
[src]
Pause the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerPause
pub async fn unpause(&self) -> Result<()>
[src]
Unpause the container instance
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerUnpause
pub async fn wait(&self) -> Result<Exit>
[src]
Wait until the container stops
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerWait
pub async fn delete(&self) -> Result<()>
[src]
Delete the container instance
Use remove instead to use the force/v options.
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerDelete
pub async fn remove(&self, opts: RmContainerOptions) -> Result<()>
[src]
Delete the container instance (todo: force/v)
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerRemove
pub fn exec(
&self,
opts: &ExecContainerOptions
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
[src]
&self,
opts: &ExecContainerOptions
) -> impl Stream<Item = Result<TtyChunk>> + Unpin + 'docker
Execute a command in this container
Api Reference: https://docs.docker.com/engine/api/v1.41/#tag/Exec
pub fn copy_from(
&self,
path: &Path
) -> impl Stream<Item = Result<Vec<u8>>> + 'docker
[src]
&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.
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/ContainerArchive
pub async fn copy_file_into<P: AsRef<Path>>(
&self,
path: P,
bytes: &[u8]
) -> Result<()>
[src]
&self,
path: P,
bytes: &[u8]
) -> Result<()>
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.
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/PutContainerArchive
pub async fn copy_to(&self, path: &Path, body: Body) -> Result<()>
[src]
Copy a tarball (see body
) to the container.
The tarball will be copied to the container and extracted at the given location (see path
).
Api Reference: https://docs.docker.com/engine/api/v1.41/#operation/PutContainerArchive
Auto Trait Implementations
impl<'docker> !RefUnwindSafe for Container<'docker>
impl<'docker> Send for Container<'docker>
impl<'docker> Sync for Container<'docker>
impl<'docker> Unpin for Container<'docker>
impl<'docker> !UnwindSafe for Container<'docker>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,