1
Fork 0

Get a unique set of image hashes running

This commit is contained in:
Jake Howard 2020-10-05 20:43:58 +01:00
parent 394d7ac3e1
commit cdcf6de960
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 12 additions and 0 deletions

View File

@ -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()
}
}