containers only returns running containers

This commit is contained in:
Roberto Alsina 2024-07-04 17:02:27 -03:00
parent 496230c4d3
commit 35283a0aea

View File

@ -178,11 +178,12 @@ module Funko
end end
end end
# Get all containers related to this funko # Get all running containers related to this funko
def containers def containers
docker_api = Docr::API.new(Docr::Client.new) docker_api = Docr::API.new(Docr::Client.new)
docker_api.containers.list(all: true).select { |container| 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 end