Class: Docker::Cli::ContainerProfile
- Inherits:
-
Object
- Object
- Docker::Cli::ContainerProfile
- Includes:
- TR::CondUtils
- Defined in:
- lib/docker/cli/docker_container.rb
Overview
only use during creation of new container
Instance Attribute Summary collapse
-
#image_name ⇒ Object
Returns the value of attribute image_name.
-
#run_command ⇒ Object
Returns the value of attribute run_command.
Instance Method Summary collapse
- #add_mount_point(host, inside_docker) ⇒ Object
- #add_port_mapping(host, docker) ⇒ Object
-
#initialize ⇒ ContainerProfile
constructor
A new instance of ContainerProfile.
- #interactive=(val) ⇒ Object
- #is_interactive? ⇒ Boolean
- #is_match_user? ⇒ Boolean
- #is_run_detached? ⇒ Boolean
- #match_user=(val) ⇒ Object
- #mount_points ⇒ Object
- #ports ⇒ Object
- #remove_after_run=(val) ⇒ Object
- #remove_after_run? ⇒ Boolean
- #run_detached=(val) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ ContainerProfile
Returns a new instance of ContainerProfile.
12 13 14 15 16 17 18 19 20 |
# File 'lib/docker/cli/docker_container.rb', line 12 def initialize @interactive = true @run_detached = false @remove_after_run = false @match_user = false @run_command = "/bin/bash" @mounts = {} @ports = {} end |
Instance Attribute Details
#image_name ⇒ Object
Returns the value of attribute image_name.
11 12 13 |
# File 'lib/docker/cli/docker_container.rb', line 11 def image_name @image_name end |
#run_command ⇒ Object
Returns the value of attribute run_command.
11 12 13 |
# File 'lib/docker/cli/docker_container.rb', line 11 def run_command @run_command end |
Instance Method Details
#add_mount_point(host, inside_docker) ⇒ Object
25 26 27 28 29 |
# File 'lib/docker/cli/docker_container.rb', line 25 def add_mount_point(host, inside_docker) if not_empty?(host) and not_empty?(inside_docker) @mounts[host] = inside_docker end end |
#add_port_mapping(host, docker) ⇒ Object
34 35 36 37 38 |
# File 'lib/docker/cli/docker_container.rb', line 34 def add_port_mapping(host, docker) if not_empty?(host) and not_empty?(docker) @ports[host] = docker end end |
#interactive=(val) ⇒ Object
43 44 45 |
# File 'lib/docker/cli/docker_container.rb', line 43 def interactive=(val) @interactive = val end |
#is_interactive? ⇒ Boolean
40 41 42 |
# File 'lib/docker/cli/docker_container.rb', line 40 def is_interactive? @interactive end |
#is_match_user? ⇒ Boolean
61 62 63 |
# File 'lib/docker/cli/docker_container.rb', line 61 def is_match_user? @match_user end |
#is_run_detached? ⇒ Boolean
47 48 49 |
# File 'lib/docker/cli/docker_container.rb', line 47 def is_run_detached? @run_detached end |
#match_user=(val) ⇒ Object
64 65 66 |
# File 'lib/docker/cli/docker_container.rb', line 64 def match_user=(val) @match_user = val end |
#mount_points ⇒ Object
22 23 24 |
# File 'lib/docker/cli/docker_container.rb', line 22 def mount_points @mounts.freeze end |
#ports ⇒ Object
31 32 33 |
# File 'lib/docker/cli/docker_container.rb', line 31 def ports @ports.freeze end |
#remove_after_run=(val) ⇒ Object
57 58 59 |
# File 'lib/docker/cli/docker_container.rb', line 57 def remove_after_run=(val) @remove_after_run = val end |
#remove_after_run? ⇒ Boolean
54 55 56 |
# File 'lib/docker/cli/docker_container.rb', line 54 def remove_after_run? @remove_after_run end |
#run_detached=(val) ⇒ Object
50 51 52 |
# File 'lib/docker/cli/docker_container.rb', line 50 def run_detached=(val) @run_detached = val end |
#to_hash ⇒ Object
68 69 70 71 |
# File 'lib/docker/cli/docker_container.rb', line 68 def to_hash # this returns a hash that match expectation of input in CommandFactory.create_container_from_image { interactive: @interactive, tty: @interactive, detached: @run_detached, del: @remove_after_run, mounts: @mounts, ports: @ports, match_user: @match_user, command: @run_command } end |