From 35283a0aea8603e1edcd80132645a97c4b2ae4e7 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Thu, 4 Jul 2024 17:02:27 -0300 Subject: [PATCH] containers only returns running containers --- src/funko.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/funko.cr b/src/funko.cr index 4a327c5..b0003fd 100644 --- a/src/funko.cr +++ b/src/funko.cr @@ -178,11 +178,12 @@ module Funko end end - # Get all containers related to this funko + # Get all running containers related to this funko def containers docker_api = Docr::API.new(Docr::Client.new) docker_api.containers.list(all: true).select { |container| - container.@names.any?(&.starts_with?("/faaso-#{name}-")) + container.@names.any?(&.starts_with?("/faaso-#{name}-")) && + container.@state == "running" } end