Class: Dip::Commands::SSH::Up

Inherits:
Dip::Command show all
Defined in:
lib/dip/commands/ssh.rb

Instance Method Summary collapse

Methods inherited from Dip::Command

shell, subshell

Constructor Details

#initialize(key:, volume:, interactive:) ⇒ Up

Returns a new instance of Up.



10
11
12
13
14
# File 'lib/dip/commands/ssh.rb', line 10

def initialize(key:, volume:, interactive:)
  @key = key
  @volume = volume
  @interactive = interactive
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
# File 'lib/dip/commands/ssh.rb', line 16

def execute
  subshell("docker", "volume create --name ssh_data".shellsplit, out: File::NULL, err: File::NULL)

  subshell("docker", "run --detach --volume ssh_data:/ssh --name=ssh-agent whilp/ssh-agent".shellsplit)

  key = Dip.env.interpolate(@key)
  subshell("docker", "run #{container_args} whilp/ssh-agent ssh-add #{key}".shellsplit)
end