Struct podman_api::api::Image
source · [−]pub struct Image<'podman> { /* private fields */ }
Expand description
Interface for accessing and manipulating Podman Image.
Implementations
sourceimpl<'podman> Image<'podman>
impl<'podman> Image<'podman>
sourcepub async fn inspect(&self) -> Result<LibpodImageInspectResponse>
pub async fn inspect(&self) -> Result<LibpodImageInspectResponse>
Obtain low-level information about this image.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman.images().get("debian").inspect().await {
Ok(info) => println!("{:?}", info),
Err(e) => eprintln!("{}", e),
}
};
sourcepub async fn history(&self) -> Result<HistoryResponseItem>
pub async fn history(&self) -> Result<HistoryResponseItem>
Return parent layers of an image.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman.images().get("debian").history().await {
Ok(info) => println!("{:?}", info),
Err(e) => eprintln!("{}", e),
}
};
sourcepub async fn exists(&self) -> Result<bool>
pub async fn exists(&self) -> Result<bool>
Quick way to determine if a image exists by name or ID.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman.images().get("debian").exists().await {
Ok(exists) => if exists {
println!("image exists!");
} else {
println!("image doesn't exists!");
},
Err(e) => eprintln!("check failed: {}", e),
}
};
sourcepub async fn delete(&self) -> Result<()>
pub async fn delete(&self) -> Result<()>
Delete this image from local storage. To forcefully remove an image use
Image::remove
.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
if let Err(e) = podman.images().get("debian").delete().await {
eprintln!("{}", e);
}
};
sourcepub async fn remove(&self) -> Result<()>
pub async fn remove(&self) -> Result<()>
Remove this image forcefully from local storage. To remove the image normally use
Image::delete
.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
if let Err(e) = podman.images().get("debian").remove().await {
eprintln!("{}", e);
}
};
sourcepub async fn tag(&self, opts: &ImageTagOpts) -> Result<()>
pub async fn tag(&self, opts: &ImageTagOpts) -> Result<()>
Tag an image so that it becomes part of a repository.
Examples:
async {
use podman_api::Podman;
use podman_api::opts::ImageTagOpts;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
if let Err(e) = podman
.images()
.get("debian")
.tag(
&ImageTagOpts::builder()
.repo("my.custom.repo/debian")
.tag("1.0.0")
.build(),
)
.await
{
eprintln!("{}", e);
}
};
sourcepub async fn untag(&self, opts: &ImageTagOpts) -> Result<()>
pub async fn untag(&self, opts: &ImageTagOpts) -> Result<()>
Untag an image. If repo and tag are not specified, all tags are removed from the image.
Examples:
async {
use podman_api::Podman;
use podman_api::opts::ImageTagOpts;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
if let Err(e) = podman
.images()
.get("debian")
.untag(
&ImageTagOpts::builder()
.repo("my.custom.repo/debian")
.tag("1.0.0")
.build(),
)
.await
{
eprintln!("{}", e);
}
};
sourcepub fn export(
&self,
opts: &ImageExportOpts
) -> impl Stream<Item = Result<Vec<u8>>> + Unpin + 'podman
pub fn export(
&self,
opts: &ImageExportOpts
) -> impl Stream<Item = Result<Vec<u8>>> + Unpin + 'podman
Export this image.
sourcepub async fn changes(
&self,
opts: &ChangesOpts
) -> Result<Vec<ContainerChangeResponseItem>>
pub async fn changes(
&self,
opts: &ChangesOpts
) -> Result<Vec<ContainerChangeResponseItem>>
Returns which files in this image’s filesystem have been added, deleted, or modified.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman
.images()
.get("79c93f220e3e")
.changes(&Default::default())
.await
{
Ok(changes) => println!("{:?}", changes),
Err(e) => eprintln!("{}", e),
}
};
sourcepub async fn tree(
&self,
opts: &ImageTreeOpts
) -> Result<Vec<LibpodImageTreeResponse>>
pub async fn tree(
&self,
opts: &ImageTreeOpts
) -> Result<Vec<LibpodImageTreeResponse>>
Retrieve the image tree for this image.
Examples:
async {
use podman_api::Podman;
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman
.images()
.get("79c93f220e3e")
.tree(&Default::default())
.await
{
Ok(tree) => println!("{:?}", tree),
Err(e) => eprintln!("{}", e),
}
};
sourcepub async fn push(&self, opts: &ImagePushOpts) -> Result<String>
pub async fn push(&self, opts: &ImagePushOpts) -> Result<String>
Push this image to a container registry.
Examples:
async {
use podman_api::Podman;
use podman_api::opts::{RegistryAuth, ImagePushOpts};
let podman = Podman::unix("/run/user/1000/podman/podman.sock");
match podman.images().get("alpine").push(
&ImagePushOpts::builder()
.destinations("my-destination")
.tls_verify(true)
.auth(
RegistryAuth::builder()
.username("test")
.password("test")
.server_address("https://my-registry")
.build(),
)
.build(),
).await {
Ok(s) => println!("{}", s),
Err(e) => eprintln!("{}", e),
};
};
Trait Implementations
Auto Trait Implementations
impl<'podman> !RefUnwindSafe for Image<'podman>
impl<'podman> Send for Image<'podman>
impl<'podman> Sync for Image<'podman>
impl<'podman> Unpin for Image<'podman>
impl<'podman> !UnwindSafe for Image<'podman>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more