Method: Beaker::Docker#get_container_opts

Defined in:
lib/beaker/hypervisor/docker.rb

#get_container_opts(host, image_name) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/beaker/hypervisor/docker.rb', line 72

def get_container_opts(host, image_name)
  container_opts = StringifyHash.new
  container_opts['ExposedPorts'] = { '22/tcp' => {} } if host['dockerfile']

  container_opts.merge!({
                          'Image' => image_name,
                          'Hostname' => host.name,
                          'HostConfig' => {
                            'PortBindings' => {
                              '22/tcp' => [{ 'HostPort' => rand(1025..9999).to_s, 'HostIp' => '0.0.0.0' }],
                            },
                            'PublishAllPorts' => true,
                            'RestartPolicy' => {
                              'Name' => 'always',
                            },
                          },
                        })
end