plugins: experimental support for new plugin management

This patch introduces a new experimental engine-level plugin management
with a new API and command line. Plugins can be distributed via a Docker
registry, and their lifecycle is managed by the engine.
This makes plugins a first-class construct.

For more background, have a look at issue #20363.

Documentation is in a separate commit. If you want to understand how the
new plugin system works, you can start by reading the documentation.

Note: backwards compatibility with existing plugins is maintained,
albeit they won't benefit from the advantages of the new system.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Tibor Vass 2016-05-16 11:50:55 -04:00
parent 50626d2b2b
commit 11c8c6c8fc
2 changed files with 23 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/docker/docker/api/client/image" "github.com/docker/docker/api/client/image"
"github.com/docker/docker/api/client/network" "github.com/docker/docker/api/client/network"
"github.com/docker/docker/api/client/node" "github.com/docker/docker/api/client/node"
"github.com/docker/docker/api/client/plugin"
"github.com/docker/docker/api/client/registry" "github.com/docker/docker/api/client/registry"
"github.com/docker/docker/api/client/service" "github.com/docker/docker/api/client/service"
"github.com/docker/docker/api/client/swarm" "github.com/docker/docker/api/client/swarm"
@ -81,6 +82,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
system.NewVersionCommand(dockerCli), system.NewVersionCommand(dockerCli),
volume.NewVolumeCommand(dockerCli), volume.NewVolumeCommand(dockerCli),
) )
plugin.NewPluginCommand(rootCmd, dockerCli)
rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage") rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage")
rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help") rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")

21
error.go Normal file
View File

@ -0,0 +1,21 @@
package cli
import "bytes"
// Errors is a list of errors.
// Useful in a loop if you don't want to return the error right away and you want to display after the loop,
// all the errors that happened during the loop.
type Errors []error
func (errs Errors) Error() string {
if len(errs) < 1 {
return ""
}
var buf bytes.Buffer
buf.WriteString(errs[0].Error())
for _, err := range errs[1:] {
buf.WriteString(", ")
buf.WriteString(err.Error())
}
return buf.String()
}