dockerun 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dockerun/command/run.rb +6 -1
- data/lib/dockerun/command/run_new_container.rb +1 -1
- data/lib/dockerun/command/run_new_image.rb +1 -1
- data/lib/dockerun/config.rb +18 -1
- data/lib/dockerun/docker_container_helper.rb +11 -2
- data/lib/dockerun/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d56f73dfb5c9d69bf40fc5390cf7f97fe1d372741876849c93f18c736c4cfd74
|
4
|
+
data.tar.gz: 9a04ddab0fd5c33068f5d94d91a38cae34662b00efe41ec3d5dbb64d9050b5ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67558d361248855d989b111878b00f43f6180b04bfb2f541b1491f8fb67e281c13e66398d5d9005a9ecd27710ce2353bea650555c40d6c5c96aa136b521db69a
|
7
|
+
data.tar.gz: cdf8d67ba8487b7b6425387c10cf444885f1729230559de48033f9182d330ee1a7b14e570feb33550e7efe209ab00e436365b46b145323cc3b45bfde5062ef0a
|
data/Gemfile.lock
CHANGED
data/lib/dockerun/command/run.rb
CHANGED
@@ -152,6 +152,7 @@ module Dockerun
|
|
152
152
|
contNames = config.container_names(imageName)
|
153
153
|
|
154
154
|
selContName = nil
|
155
|
+
port_mapping = {}
|
155
156
|
if contNames.length == 0
|
156
157
|
selContName = nil
|
157
158
|
elsif contNames.length == 1
|
@@ -173,7 +174,7 @@ module Dockerun
|
|
173
174
|
end
|
174
175
|
end
|
175
176
|
|
176
|
-
selContName = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
|
177
|
+
selContName, otherConfigs = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
|
177
178
|
case ops
|
178
179
|
when :new_container_name
|
179
180
|
cli.ask("\n Please provide a new container name : ".yellow, required: true)
|
@@ -210,6 +211,10 @@ module Dockerun
|
|
210
211
|
|
211
212
|
config.add_container(imageName, selContName)
|
212
213
|
|
214
|
+
config.add_mount_to_container(imagename, selContName, mount_points)
|
215
|
+
|
216
|
+
config.add_port_mapping_to_container(imagename, selContName, @otherConfigs[:port_mapping]) if not_empty?(@otherConfigs[:port_mapping])
|
217
|
+
|
213
218
|
config.to_storage
|
214
219
|
|
215
220
|
end
|
@@ -49,7 +49,7 @@ module Dockerun
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
contName = run_docker_container(imageName, nil) do |ops, *args|
|
52
|
+
contName, otherConfigs = run_docker_container(imageName, nil) do |ops, *args|
|
53
53
|
case ops
|
54
54
|
when :new_container_name
|
55
55
|
cli.ask("Please provide a new container name : ", required: true)
|
@@ -55,7 +55,7 @@ module Dockerun
|
|
55
55
|
|
56
56
|
contNames = config.container_names(imageName)
|
57
57
|
|
58
|
-
selContName = run_docker_container(imageName, selContName) do |ops, *args|
|
58
|
+
selContName, otherConfigs = run_docker_container(imageName, selContName) do |ops, *args|
|
59
59
|
case ops
|
60
60
|
when :new_container_name
|
61
61
|
cli.ask("Please provide a new container name : ", required: true)
|
data/lib/dockerun/config.rb
CHANGED
@@ -72,7 +72,12 @@ module Dockerun
|
|
72
72
|
def add_mount_to_container(imageName, container, mount)
|
73
73
|
add_container(imageName, container)
|
74
74
|
@images[imageName][container][:mount] = [] if @images[imageName][container][:mount].nil?
|
75
|
-
|
75
|
+
case mount.class
|
76
|
+
when Array
|
77
|
+
@images[imageName][container][:mount]concat(mount)
|
78
|
+
else
|
79
|
+
@images[imageName][container][:mount] << mount
|
80
|
+
end
|
76
81
|
end
|
77
82
|
|
78
83
|
def container_mount_points(imageName, container)
|
@@ -84,6 +89,18 @@ module Dockerun
|
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
92
|
+
def add_port_mapping_to_container(imageName, container, port_mapping)
|
93
|
+
add_container(imageName, container)
|
94
|
+
@images[imageName][container][:port_mapping] = [] if @images[imageName][container][:port_mapping].nil?
|
95
|
+
case mount.class
|
96
|
+
when Array
|
97
|
+
@images[imageName][container][:port_mapping]concat(port_mapping)
|
98
|
+
else
|
99
|
+
@images[imageName][container][:port_mapping] << port_mapping
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
87
104
|
def to_storage
|
88
105
|
res = { images: @images }
|
89
106
|
|
@@ -49,6 +49,7 @@ module Dockerun
|
|
49
49
|
#end
|
50
50
|
end
|
51
51
|
|
52
|
+
@other_configs = {}
|
52
53
|
if reuse == true
|
53
54
|
|
54
55
|
Dockerun.udebug "Find out of container '#{container_name}' is running..."
|
@@ -143,13 +144,21 @@ module Dockerun
|
|
143
144
|
|
144
145
|
#end
|
145
146
|
|
147
|
+
addPortMapping = block.call(:add_port_mapping?)
|
148
|
+
port_mapping = {}
|
149
|
+
if addPortMapping
|
150
|
+
portOnHost = block.call(:port_on_host)
|
151
|
+
portOnDocker = block.call(:port_on_docker)
|
152
|
+
port_mapping[portOnHost] = portOnDocker
|
153
|
+
end
|
146
154
|
|
155
|
+
@other_configs[:port_mapping] = port_mapping if not_empty?(port_mapping)
|
147
156
|
|
148
|
-
dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points).run
|
157
|
+
dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points, ports: port_mapping).run
|
149
158
|
|
150
159
|
end
|
151
160
|
|
152
|
-
container_name
|
161
|
+
[container_name, @other_configs]
|
153
162
|
|
154
163
|
end
|
155
164
|
|
data/lib/dockerun/version.rb
CHANGED