mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
1ac350a0ec
This commit makes use of the CNM model supported by LibNetwork and provides an ability to let a container to publish a specified service. Behind the scenes, if a service with the given name doesnt exist, it is automatically created on appropriate network and attach the container. Signed-off-by: Alessandro Boch <aboch@docker.com> Signed-off-by: Madhu Venugopal <madhu@docker.com>
21 lines
761 B
Go
21 lines
761 B
Go
// +build experimental
|
|
|
|
package runconfig
|
|
|
|
import flag "github.com/docker/docker/pkg/mflag"
|
|
|
|
type experimentalFlags struct {
|
|
flags map[string]interface{}
|
|
}
|
|
|
|
func attachExperimentalFlags(cmd *flag.FlagSet) *experimentalFlags {
|
|
flags := make(map[string]interface{})
|
|
flags["volume-driver"] = cmd.String([]string{"-volume-driver"}, "", "Optional volume driver for the container")
|
|
flags["publish-service"] = cmd.String([]string{"-publish-service"}, "", "Publish this container as a service")
|
|
return &experimentalFlags{flags: flags}
|
|
}
|
|
|
|
func applyExperimentalFlags(exp *experimentalFlags, config *Config, hostConfig *HostConfig) {
|
|
config.VolumeDriver = *(exp.flags["volume-driver"]).(*string)
|
|
config.PublishService = *(exp.flags["publish-service"]).(*string)
|
|
}
|