Method: EcsCmd::Exec.execute

Defined in:
lib/ecs_cmd/exec.rb

.execute(task_family, ip, command, user = 'root') ⇒ Object

used to run arbitrary command inside a container



20
21
22
23
24
25
26
27
# File 'lib/ecs_cmd/exec.rb', line 20

def execute(task_family, ip, command, user = 'root')
  cmd = "docker exec -i -t -u #{user} `#{docker_ps_task(task_family)}` #{command}"
  Open3.popen2e(ssh_cmd(ip) + " '#{cmd}' ") do |stdin, stdout, stderr, status_thread|
    stdout.each_line do |line|
      puts line
    end
  end
end