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

View File

@ -107,7 +107,7 @@ class Funko
end end
# Create a container for this funko # 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( conf = Docr::Types::CreateContainerConfig.new(
image: "#{name}:latest", image: "#{name}:latest",
hostname: name, hostname: name,
@ -127,7 +127,7 @@ class Funko
docker_api = Docr::API.new(Docr::Client.new) docker_api = Docr::API.new(Docr::Client.new)
response = docker_api.containers.create(name: "faaso-#{name}", config: conf) response = docker_api.containers.create(name: "faaso-#{name}", config: conf)
response.@warnings.each { |msg| puts "Warning: #{msg}" } 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 response.@id
end end
end end