|
@@ -23,10 +23,12 @@ import (
|
|
"github.com/docker/docker/api/server/router/image"
|
|
"github.com/docker/docker/api/server/router/image"
|
|
"github.com/docker/docker/api/server/router/network"
|
|
"github.com/docker/docker/api/server/router/network"
|
|
pluginrouter "github.com/docker/docker/api/server/router/plugin"
|
|
pluginrouter "github.com/docker/docker/api/server/router/plugin"
|
|
|
|
+ sessionrouter "github.com/docker/docker/api/server/router/session"
|
|
swarmrouter "github.com/docker/docker/api/server/router/swarm"
|
|
swarmrouter "github.com/docker/docker/api/server/router/swarm"
|
|
systemrouter "github.com/docker/docker/api/server/router/system"
|
|
systemrouter "github.com/docker/docker/api/server/router/system"
|
|
"github.com/docker/docker/api/server/router/volume"
|
|
"github.com/docker/docker/api/server/router/volume"
|
|
"github.com/docker/docker/cli/debug"
|
|
"github.com/docker/docker/cli/debug"
|
|
|
|
+ "github.com/docker/docker/client/session"
|
|
"github.com/docker/docker/daemon"
|
|
"github.com/docker/docker/daemon"
|
|
"github.com/docker/docker/daemon/cluster"
|
|
"github.com/docker/docker/daemon/cluster"
|
|
"github.com/docker/docker/daemon/config"
|
|
"github.com/docker/docker/daemon/config"
|
|
@@ -46,6 +48,7 @@ import (
|
|
"github.com/docker/docker/runconfig"
|
|
"github.com/docker/docker/runconfig"
|
|
"github.com/docker/go-connections/tlsconfig"
|
|
"github.com/docker/go-connections/tlsconfig"
|
|
swarmapi "github.com/docker/swarmkit/api"
|
|
swarmapi "github.com/docker/swarmkit/api"
|
|
|
|
+ "github.com/pkg/errors"
|
|
"github.com/spf13/pflag"
|
|
"github.com/spf13/pflag"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -215,6 +218,11 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
|
|
logrus.Warnln("LCOW support is enabled - this feature is incomplete")
|
|
logrus.Warnln("LCOW support is enabled - this feature is incomplete")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ sm, err := session.NewManager()
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.Wrap(err, "failed to create sessionmanager")
|
|
|
|
+ }
|
|
|
|
+
|
|
d, err := daemon.NewDaemon(cli.Config, registryService, containerdRemote, pluginStore)
|
|
d, err := daemon.NewDaemon(cli.Config, registryService, containerdRemote, pluginStore)
|
|
if err != nil {
|
|
if err != nil {
|
|
return fmt.Errorf("Error starting daemon: %v", err)
|
|
return fmt.Errorf("Error starting daemon: %v", err)
|
|
@@ -260,6 +268,11 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
|
|
logrus.Fatalf("Error starting cluster component: %v", err)
|
|
logrus.Fatalf("Error starting cluster component: %v", err)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bb, err := buildbackend.NewBackend(d, d, sm, d.IDMappings())
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.Wrap(err, "failed to create buildmanager")
|
|
|
|
+ }
|
|
|
|
+
|
|
// Restart all autostart containers which has a swarm endpoint
|
|
// Restart all autostart containers which has a swarm endpoint
|
|
// and is not yet running now that we have successfully
|
|
// and is not yet running now that we have successfully
|
|
// initialized the cluster.
|
|
// initialized the cluster.
|
|
@@ -269,7 +282,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
|
|
|
|
|
|
cli.d = d
|
|
cli.d = d
|
|
|
|
|
|
- initRouter(api, d, c)
|
|
|
|
|
|
+ initRouter(api, d, c, sm, bb)
|
|
|
|
|
|
// process cluster change notifications
|
|
// process cluster change notifications
|
|
watchCtx, cancel := context.WithCancel(context.Background())
|
|
watchCtx, cancel := context.WithCancel(context.Background())
|
|
@@ -442,7 +455,7 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
|
return conf, nil
|
|
return conf, nil
|
|
}
|
|
}
|
|
|
|
|
|
-func initRouter(s *apiserver.Server, d *daemon.Daemon, c *cluster.Cluster) {
|
|
|
|
|
|
+func initRouter(s *apiserver.Server, d *daemon.Daemon, c *cluster.Cluster, sm *session.Manager, bb *buildbackend.Backend) {
|
|
decoder := runconfig.ContainerDecoder{}
|
|
decoder := runconfig.ContainerDecoder{}
|
|
|
|
|
|
routers := []router.Router{
|
|
routers := []router.Router{
|
|
@@ -452,7 +465,8 @@ func initRouter(s *apiserver.Server, d *daemon.Daemon, c *cluster.Cluster) {
|
|
image.NewRouter(d, decoder),
|
|
image.NewRouter(d, decoder),
|
|
systemrouter.NewRouter(d, c),
|
|
systemrouter.NewRouter(d, c),
|
|
volume.NewRouter(d),
|
|
volume.NewRouter(d),
|
|
- build.NewRouter(buildbackend.NewBackend(d, d, d.IDMappings()), d),
|
|
|
|
|
|
+ build.NewRouter(bb, d),
|
|
|
|
+ sessionrouter.NewRouter(sm),
|
|
swarmrouter.NewRouter(c),
|
|
swarmrouter.NewRouter(c),
|
|
pluginrouter.NewRouter(d.PluginManager()),
|
|
pluginrouter.NewRouter(d.PluginManager()),
|
|
distributionrouter.NewRouter(d),
|
|
distributionrouter.NewRouter(d),
|