Class: Vx::ContainerConnector::Docker
- Inherits:
-
Object
- Object
- Vx::ContainerConnector::Docker
- Includes:
- Vx::Common::Spawn, Instrument, Retriable
- Defined in:
- lib/vx/container_connector/docker.rb,
lib/vx/container_connector/docker/default.rb,
lib/vx/container_connector/docker/spawner.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#init ⇒ Object
readonly
Returns the value of attribute init.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#memory_swap ⇒ Object
readonly
Returns the value of attribute memory_swap.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#remote_dir ⇒ Object
readonly
Returns the value of attribute remote_dir.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #create_container_options ⇒ Object
-
#initialize(options = {}) ⇒ Docker
constructor
A new instance of Docker.
- #start(&block) ⇒ Object
- #start_container_options ⇒ Object
Methods included from Instrument
Methods included from Retriable
Constructor Details
#initialize(options = {}) ⇒ Docker
Returns a new instance of Docker.
20 21 22 23 24 25 26 27 28 |
# File 'lib/vx/container_connector/docker.rb', line 20 def initialize( = {}) @user = [:user] || "vexor" @password = [:password] || "vexor" @init = [:init] || %w{ /sbin/my_init } @image = [:image] || "ubuntu" @remote_dir = [:remote_dir] || "/home/#{user}" @memory = [:memory].to_i @memory_swap = [:memory_swap].to_i end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def image @image end |
#init ⇒ Object (readonly)
Returns the value of attribute init.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def init @init end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def memory @memory end |
#memory_swap ⇒ Object (readonly)
Returns the value of attribute memory_swap.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def memory_swap @memory_swap end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def password @password end |
#remote_dir ⇒ Object (readonly)
Returns the value of attribute remote_dir.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def remote_dir @remote_dir end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
18 19 20 |
# File 'lib/vx/container_connector/docker.rb', line 18 def user @user end |
Instance Method Details
#create_container_options ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/vx/container_connector/docker.rb', line 36 def Default..merge( 'Cmd' => init, 'Image' => image, 'Memory' => memory, 'MemorySwap' => memory_swap ) end |
#start(&block) ⇒ Object
30 31 32 33 34 |
# File 'lib/vx/container_connector/docker.rb', line 30 def start(&block) start_container do |container| open_ssh_session(container, &block) end end |
#start_container_options ⇒ Object
45 46 47 |
# File 'lib/vx/container_connector/docker.rb', line 45 def Default. end |