lib/dockerun/docker_container_helper.rb in dockerun-0.3.5 vs lib/dockerun/docker_container_helper.rb in dockerun-0.3.6
- old
+ new
@@ -47,10 +47,11 @@
#else
# # if not found shall drop into the next block's else clause
#end
end
+ @other_configs = {}
if reuse == true
Dockerun.udebug "Find out of container '#{container_name}' is running..."
#res = dcFact.find_running_container(container_name).run
#if not res.failed? and res.is_out_stream_empty?
@@ -141,16 +142,24 @@
# block.call(:on_docker_init_file_path,@docker_init_file_path)
#end
+ addPortMapping = block.call(:add_port_mapping?)
+ port_mapping = {}
+ if addPortMapping
+ portOnHost = block.call(:port_on_host)
+ portOnDocker = block.call(:port_on_docker)
+ port_mapping[portOnHost] = portOnDocker
+ end
+ @other_configs[:port_mapping] = port_mapping if not_empty?(port_mapping)
- dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points).run
+ dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points, ports: port_mapping).run
end
- container_name
+ [container_name, @other_configs]
end
private
def is_container_exist?(name)