Module: Tid::Docker
- Defined in:
- lib/tid/docker.rb
Class Method Summary collapse
- .build ⇒ Object
- .container_name ⇒ Object
- .container_ssh_port ⇒ Object
- .hostname ⇒ Object
- .image_name ⇒ Object
- .rm ⇒ Object
- .rmi ⇒ Object
- .run ⇒ Object
- .stop ⇒ Object
Class Method Details
.build ⇒ Object
4 5 6 |
# File 'lib/tid/docker.rb', line 4 def build Console.cmd "docker build -t #{image_name} #{Tid.base_path}" end |
.container_name ⇒ Object
40 41 42 |
# File 'lib/tid/docker.rb', line 40 def container_name ENV['TID_CONTAINER_NAME'] || 'tid' end |
.container_ssh_port ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/tid/docker.rb', line 32 def container_ssh_port _, _, ex = Console.cmd "docker ps | grep #{container_name}" if ex.exitstatus.zero? out, _, _ = Console.cmd("docker port #{container_name} 22") out.to_s.chomp.gsub('0.0.0.0:', '') end end |
.hostname ⇒ Object
24 25 26 |
# File 'lib/tid/docker.rb', line 24 def hostname Boot2docker.have? ? Boot2docker.ip : 'localhost' end |
.image_name ⇒ Object
28 29 30 |
# File 'lib/tid/docker.rb', line 28 def image_name ENV['TID_IMAGE_NAME'] || 'tid' end |
.rm ⇒ Object
16 17 18 |
# File 'lib/tid/docker.rb', line 16 def rm Console.cmd "docker rm #{container_name}" end |
.rmi ⇒ Object
20 21 22 |
# File 'lib/tid/docker.rb', line 20 def rmi Console.cmd "docker rmi #{image_name}" end |