sal_virt/nerdctl/
images.rs1use super::NerdctlError;
4use crate::nerdctl::execute_nerdctl_command;
5use sal_process::CommandResult;
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct Image {
11 pub id: String,
13 pub repository: String,
15 pub tag: String,
17 pub size: String,
19 pub created: String,
21}
22
23pub fn images() -> Result<CommandResult, NerdctlError> {
25 execute_nerdctl_command(&["images"])
26}
27
28pub fn image_remove(image: &str) -> Result<CommandResult, NerdctlError> {
34 execute_nerdctl_command(&["rmi", image])
35}
36
37pub fn image_push(image: &str, destination: &str) -> Result<CommandResult, NerdctlError> {
44 execute_nerdctl_command(&["push", image, destination])
45}
46
47pub fn image_tag(image: &str, new_name: &str) -> Result<CommandResult, NerdctlError> {
54 execute_nerdctl_command(&["tag", image, new_name])
55}
56
57pub fn image_pull(image: &str) -> Result<CommandResult, NerdctlError> {
63 execute_nerdctl_command(&["pull", image])
64}
65
66pub fn image_commit(container: &str, image_name: &str) -> Result<CommandResult, NerdctlError> {
73 execute_nerdctl_command(&["commit", container, image_name])
74}
75
76pub fn image_build(tag: &str, context_path: &str) -> Result<CommandResult, NerdctlError> {
83 execute_nerdctl_command(&["build", "-t", tag, context_path])
84}