Get a unique set of image hashes running
This commit is contained in:
parent
394d7ac3e1
commit
cdcf6de960
1 changed files with 12 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
use std::collections::HashSet;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
|
@ -26,4 +27,15 @@ impl ComposeProject {
|
|||
.status()
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
pub fn get_images(&self) -> HashSet<String> {
|
||||
let output = Command::new("docker-compose")
|
||||
.current_dir(self.working_directory())
|
||||
.args(&["-f", &self.compose_file.to_string_lossy()])
|
||||
.args(&["images", "-q"])
|
||||
.output()
|
||||
.expect("Failed to get images");
|
||||
let stdout = String::from_utf8(output.stdout).expect("Failed to parse output");
|
||||
stdout.trim().split('\n').map(String::from).collect()
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue