From 19ecd49ed085b6c647fa2c69fbd1ec7dad27b8de Mon Sep 17 00:00:00 2001 From: Lajos Papp Date: Mon, 16 Sep 2019 12:26:00 +0200 Subject: [PATCH] implement ctr -connect-timeout Signed-off-by: Lajos Papp --- cmd/ctr/commands/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/ctr/commands/client.go b/cmd/ctr/commands/client.go index b436186b2..c6bdc390c 100644 --- a/cmd/ctr/commands/client.go +++ b/cmd/ctr/commands/client.go @@ -47,6 +47,8 @@ func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc) // NewClient returns a new containerd client func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { + timeoutOpt := containerd.WithTimeout(context.GlobalDuration("connect-timeout")) + opts = append(opts, timeoutOpt) client, err := containerd.New(context.GlobalString("address"), opts...) if err != nil { return nil, nil, nil, err