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

View file

@ -1,3 +1,4 @@
use std::collections::HashSet;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command; use std::process::Command;
@ -26,4 +27,15 @@ impl ComposeProject {
.status() .status()
.is_ok() .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()
}
} }