Module: Docker
Defined Under Namespace
Classes: Error
Instance Method Summary
collapse
#capture_output, #execute, #run
Instance Method Details
#container_id(container_name) ⇒ Object
15
16
17
18
|
# File 'lib/utils/docker.rb', line 15
def container_id(container_name)
id = docker(%(container ps -q --filter "name=#{container_name}")).stdout
id.empty? ? raise(Error, "container with name #{container_name} does not exist") : id
end
|
#docker(command) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/utils/docker.rb', line 24
def docker(command)
command = "docker #{command}"
run(command).tap do |output|
raise(Error, "Failed to run: #{command}\n#{output}") if output.error?
end
end
|
#docker_exec(command) ⇒ Object
20
21
22
|
# File 'lib/utils/docker.rb', line 20
def docker_exec(command)
system "docker exec #{command}"
end
|