Module: Kamal::Commands::App::Containers

Included in:
Kamal::Commands::App
Defined in:
lib/kamal/commands/app/containers.rb

Constant Summary collapse

DOCKER_HEALTH_LOG_FORMAT =
"'{{json .State.Health}}'"

Instance Method Summary collapse

Instance Method Details

#container_health_log(version:) ⇒ Object



26
27
28
29
30
# File 'lib/kamal/commands/app/containers.rb', line 26

def container_health_log(version:)
  pipe \
    container_id_for(container_name: container_name(version)),
    xargs(docker(:inspect, "--format", DOCKER_HEALTH_LOG_FORMAT))
end

#list_container_namesObject



8
9
10
# File 'lib/kamal/commands/app/containers.rb', line 8

def list_container_names
  [ *list_containers, "--format", "'{{ .Names }}'" ]
end

#list_containersObject



4
5
6
# File 'lib/kamal/commands/app/containers.rb', line 4

def list_containers
  docker :container, :ls, "--all", *filter_args
end

#remove_container(version:) ⇒ Object



12
13
14
15
16
# File 'lib/kamal/commands/app/containers.rb', line 12

def remove_container(version:)
  pipe \
    container_id_for(container_name: container_name(version)),
    xargs(docker(:container, :rm))
end

#remove_containersObject



22
23
24
# File 'lib/kamal/commands/app/containers.rb', line 22

def remove_containers
  docker :container, :prune, "--force", *filter_args
end

#rename_container(version:, new_version:) ⇒ Object



18
19
20
# File 'lib/kamal/commands/app/containers.rb', line 18

def rename_container(version:, new_version:)
  docker :rename, container_name(version), container_name(new_version)
end