File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ type RunOptions struct {
173
173
CapAdd []string
174
174
SecurityOpt []string
175
175
WorkingDir string
176
+ NetworkID string
176
177
Labels map [string ]string
177
178
Auth dc.AuthConfiguration
178
179
PortBindings map [dc.Port ][]dc.PortBinding
@@ -243,6 +244,13 @@ func (d *Pool) RunWithOptions(opts *RunOptions) (*Resource, error) {
243
244
tag = "latest"
244
245
}
245
246
247
+ networkingConfig := dc.NetworkingConfig {
248
+ EndpointsConfig : map [string ]* dc.EndpointConfig {},
249
+ }
250
+ if opts .NetworkID != "" {
251
+ networkingConfig .EndpointsConfig [opts .NetworkID ] = & dc.EndpointConfig {}
252
+ }
253
+
246
254
_ , err := d .Client .InspectImage (fmt .Sprintf ("%s:%s" , repository , tag ))
247
255
if err != nil {
248
256
if err := d .Client .PullImage (dc.PullImageOptions {
@@ -277,6 +285,7 @@ func (d *Pool) RunWithOptions(opts *RunOptions) (*Resource, error) {
277
285
SecurityOpt : opts .SecurityOpt ,
278
286
Privileged : opts .Privileged ,
279
287
},
288
+ NetworkingConfig : & networkingConfig ,
280
289
})
281
290
if err != nil {
282
291
return nil , errors .Wrap (err , "" )
You can’t perform that action at this time.
0 commit comments