Create a new client on each request

`docker serve` doesn't need a context any more, the server takes the
current context from the request metadata and creates a new client
This commit is contained in:
Djordje Lukic 2020-04-29 23:39:54 +02:00
parent 9ea91791b4
commit 8571cf5a04
6 changed files with 49 additions and 27 deletions

View file

@ -5,7 +5,6 @@ import (
"net"
cliv1 "github.com/docker/api/cli/v1"
"github.com/docker/api/client"
"github.com/docker/api/containers/proxy"
containersv1 "github.com/docker/api/containers/v1"
"github.com/docker/api/context/store"
@ -45,12 +44,7 @@ func runServe(ctx context.Context, opts serveOpts) error {
}
defer l.Close()
c, err := client.New(ctx)
if err != nil {
return err
}
p := proxy.NewContainerApi(c)
p := proxy.NewContainerApi()
containersv1.RegisterContainersServer(s, p)
cliv1.RegisterCliServer(s, &cliServer{