pub struct ImageRef<'a> { /* private fields */ }Expand description
Reference to a specific image.
Implementations§
Source§impl<'a> ImageRef<'a>
impl<'a> ImageRef<'a>
Sourcepub async fn inspect(&self) -> Result<ImageInspect>
pub async fn inspect(&self) -> Result<ImageInspect>
Inspect the image to get detailed information.
§Example
use docker_client::DockerClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DockerClient::new()?;
let info = client.images().get("nginx:latest").inspect().await?;
println!("Image ID: {:?}", info.id);
Ok(())
}Sourcepub async fn history(&self) -> Result<Vec<HistoryResponseItem>>
pub async fn history(&self) -> Result<Vec<HistoryResponseItem>>
Get the history of the image (layer information).
Sourcepub async fn tag(&self, new_tag: impl Into<String>) -> Result<()>
pub async fn tag(&self, new_tag: impl Into<String>) -> Result<()>
Tag the image with a new name/tag.
§Example
use docker_client::DockerClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DockerClient::new()?;
client.images()
.get("nginx:latest")
.tag("my-nginx:v1.0")
.await?;
Ok(())
}Sourcepub async fn push(&self, credentials: Option<DockerCredentials>) -> Result<()>
pub async fn push(&self, credentials: Option<DockerCredentials>) -> Result<()>
Push the image to a registry.
§Arguments
credentials- Optional Docker registry credentials
§Example
use docker_client::DockerClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DockerClient::new()?;
client.images()
.get("myregistry.com/my-app:v1.0")
.push(None)
.await?;
Ok(())
}Auto Trait Implementations§
impl<'a> Freeze for ImageRef<'a>
impl<'a> !RefUnwindSafe for ImageRef<'a>
impl<'a> Send for ImageRef<'a>
impl<'a> Sync for ImageRef<'a>
impl<'a> Unpin for ImageRef<'a>
impl<'a> !UnwindSafe for ImageRef<'a>
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