support for defining docker network opts
This commit is contained in:
@@ -73,6 +73,10 @@ type Compiler struct {
|
||||
// attached to each pipeline container.
|
||||
Networks []string
|
||||
|
||||
// NetworkOpts provides a set of network options that
|
||||
// are used when creating the docker network.
|
||||
NetworkOpts map[string]string
|
||||
|
||||
// Volumes provides a set of volumes that should be
|
||||
// mounted to each pipeline container.
|
||||
Volumes map[string]string
|
||||
@@ -154,8 +158,9 @@ func (c *Compiler) Compile(ctx context.Context, args runtime.CompilerArgs) runti
|
||||
|
||||
spec := &engine.Spec{
|
||||
Network: engine.Network{
|
||||
ID: random(),
|
||||
Labels: labels,
|
||||
ID: random(),
|
||||
Labels: labels,
|
||||
Options: c.NetworkOpts,
|
||||
},
|
||||
Platform: engine.Platform{
|
||||
OS: pipeline.Platform.OS,
|
||||
|
||||
@@ -83,8 +83,9 @@ func (e *Docker) Setup(ctx context.Context, specv runtime.Spec) error {
|
||||
driver = "nat"
|
||||
}
|
||||
_, err := e.client.NetworkCreate(ctx, spec.Network.ID, types.NetworkCreate{
|
||||
Driver: driver,
|
||||
Labels: spec.Network.Labels,
|
||||
Driver: driver,
|
||||
Options: spec.Network.Options,
|
||||
Labels: spec.Network.Labels,
|
||||
})
|
||||
|
||||
return errors.TrimExtraInfo(err)
|
||||
|
||||
@@ -117,8 +117,9 @@ type (
|
||||
|
||||
// Network that is created and attached to containers
|
||||
Network struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Options map[string]string `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// Auth defines dockerhub authentication credentials.
|
||||
|
||||
Reference in New Issue
Block a user