This commit is contained in:
2024-06-28 20:57:58 -03:00
parent 897b2dd59e
commit 1a5e8549f0
2 changed files with 90 additions and 4 deletions

View File

@ -64,9 +64,9 @@ module Faaso
containers = docker_api.containers.list(all: true)
pp! containers
# If it's running, do nothing
if (containers.any? { |c|
if containers.any? { |c|
c.@image == tag && c.@state == "running"
})
}
puts "#{arg} is already running"
return 0
end
@ -75,7 +75,7 @@ module Faaso
paused = containers.select { |c|
c.@image == tag && c.@state == "paused"
}
if (paused.size > 0)
if paused.size > 0
puts "Resuming existing paused container"
docker_api.containers.unpause(paused[0].@id)
return 0
@ -87,7 +87,7 @@ module Faaso
}
puts "Starting function #{arg}"
if (existing.size > 0)
if existing.size > 0
puts "Restarting existing exited container"
docker_api.containers.start(existing[0].@id)
return 0