Class: Centurion::DockerViaCli
- Inherits:
-
Object
- Object
- Centurion::DockerViaCli
show all
- Includes:
- Logging
- Defined in:
- lib/centurion/docker_via_cli.rb
Instance Method Summary
collapse
Methods included from Logging
#debug, #error, #info, #warn
Constructor Details
#initialize(hostname, port, docker_path, tls_args = {}) ⇒ DockerViaCli
Returns a new instance of DockerViaCli.
10
11
12
13
14
|
# File 'lib/centurion/docker_via_cli.rb', line 10
def initialize(hostname, port, docker_path, tls_args = {})
@docker_host = "tcp://#{hostname}:#{port}"
@docker_path = docker_path
@tls_args = tls_args
end
|
Instance Method Details
#attach(container_id) ⇒ Object
26
27
28
|
# File 'lib/centurion/docker_via_cli.rb', line 26
def attach(container_id)
Centurion::Shell.echo(build_command(:attach, container_id))
end
|
#exec(container_id, commandline) ⇒ Object
30
31
32
|
# File 'lib/centurion/docker_via_cli.rb', line 30
def exec(container_id, commandline)
Centurion::Shell.echo(build_command(:exec, "#{container_id} #{commandline}"))
end
|
#exec_it(container_id, commandline) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/centurion/docker_via_cli.rb', line 34
def exec_it(container_id, commandline)
Centurion::Shell.echo(build_command(:exec, "-it #{container_id} #{commandline} || true"))
end
|
#pull(image, tag = 'latest') ⇒ Object
16
17
18
19
|
# File 'lib/centurion/docker_via_cli.rb', line 16
def pull(image, tag='latest')
info 'Using CLI to pull'
Centurion::Shell.echo(build_command(:pull, "#{image}:#{tag}"))
end
|
#tail(container_id) ⇒ Object
21
22
23
24
|
# File 'lib/centurion/docker_via_cli.rb', line 21
def tail(container_id)
info "Tailing the logs on #{container_id}"
Centurion::Shell.echo(build_command(:logs, container_id))
end
|