This commit is contained in:
Roberto Alsina 2024-06-30 00:55:59 -03:00
parent ad520c222b
commit 342504dd50
2 changed files with 5 additions and 8 deletions

View File

@ -73,13 +73,13 @@ module Faaso
end
# Bring up one or more funkos.
#
#
# This doesn't guarantee that they will be running the latest
# version, and it will try to recicle paused and exited containers.
#
#
# If there is no other way, it will create a brand new container with
# the latest known image and start it.
#
#
# If there are no images for the funko, it will fail to bring it up.
class Up
@arguments : Array(String) = [] of String
@ -93,9 +93,6 @@ module Faaso
def run
funkos = Funko.from_paths(@arguments)
funkos.each do |funko|
container_name = "faaso-#{funko.name}"
docker_api = Docr::API.new(Docr::Client.new)
if funko.image_history.empty?
puts "Error: no images available for #{funko.name}:latest"
next

View File

@ -107,7 +107,7 @@ class Funko
end
# Create a container for this funko
def create_container( autostart : Bool = true) : String
def create_container(autostart : Bool = true) : String
conf = Docr::Types::CreateContainerConfig.new(
image: "#{name}:latest",
hostname: name,
@ -127,7 +127,7 @@ class Funko
docker_api = Docr::API.new(Docr::Client.new)
response = docker_api.containers.create(name: "faaso-#{name}", config: conf)
response.@warnings.each { |msg| puts "Warning: #{msg}" }
docker_api.containers.start(response.@id) if autostart
docker_api.containers.start(response.@id) if autostart
response.@id
end
end