pub struct DockerCompose { /* private fields */ }
Expand description
Launch and manage a docker compose instance
Implementations§
Source§impl DockerCompose
impl DockerCompose
Sourcepub fn new(
image_waiters: &'static [Image],
image_builder: impl FnOnce(&[&str]),
yaml_path: &str,
) -> Self
pub fn new( image_waiters: &'static [Image], image_builder: impl FnOnce(&[&str]), yaml_path: &str, ) -> Self
Runs docker compose on the provided docker-compose.yaml file. Dropping the returned object will stop and destroy the launched docker compose services.
image_waiters gives DockerCompose a way to know when a container has finished starting up. Each entry defines an image name and a regex such that if the regex matches on a log line output by a container running that image the container is considered started up.
image_builder is a callback allowing the user to build a docker image if the docker-compose.yaml depends on it. The argument is an iterator over all the image names docker compose is going to use.
Sourcepub fn stop_service(&self, service_name: &str)
pub fn stop_service(&self, service_name: &str)
Stops the container with the provided service name
Sourcepub fn kill_service(&self, service_name: &str)
pub fn kill_service(&self, service_name: &str)
Kills the container with the provided service name
Sourcepub fn start_service(&mut self, service_name: &str)
pub fn start_service(&mut self, service_name: &str)
Restarts the container with the provided service name