Class: SwarmClusterCliOpe::Commands::Container

Inherits:
Base
  • Object
show all
Defined in:
lib/swarm_cluster_cli_ope/commands/container.rb

Direct Known Subclasses

ComposeContainer

Instance Attribute Summary

Attributes inherited from Base

#base_suffix_command, #docker_host

Instance Method Summary collapse

Methods inherited from Base

#command, #docker_inspect, #initialize, object_identifier

Methods included from LoggerConcern

#logger

Constructor Details

This class inherits a constructor from SwarmClusterCliOpe::Commands::Base

Instance Method Details

#cp(src, dest) ⇒ Object



5
6
7
8
9
10
# File 'lib/swarm_cluster_cli_ope/commands/container.rb', line 5

def cp(src, dest)
  self.base_suffix_command = []
  command do |cmd|
    cmd.add("cp #{src} #{dest}")
  end.execute
end

#exec(container_id, cmd_str) ⇒ Object



12
13
14
15
16
17
# File 'lib/swarm_cluster_cli_ope/commands/container.rb', line 12

def exec(container_id,cmd_str)
  self.base_suffix_command = []
  command do |cmd|
    cmd.add("exec #{container_id} #{cmd_str}")
  end.execute
end

#ps(service_name: nil) ⇒ SwarmClusterCliOpe::ShellCommandResponse

Esegue il ps sui container, possibile filtrare passando nome stack e/o nome servizio

Parameters:

  • service_name (String) (defaults to: nil)

Returns:



23
24
25
26
27
28
# File 'lib/swarm_cluster_cli_ope/commands/container.rb', line 23

def ps(service_name: nil)
  command do |cmd|
    cmd.add("ps")
    cmd.add("--filter=\"label=com.docker.swarm.service.name=#{service_name}\"") if service_name
  end.execute
end