Skip to content

Commit 86442df

Browse files
authored
Merge pull request #3653 from lalyos/fix-connect-timeout
implement ctr --connect-timeout
2 parents 9339104 + 19ecd49 commit 86442df

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cmd/ctr/commands/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc)
4747

4848
// NewClient returns a new containerd client
4949
func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) {
50+
timeoutOpt := containerd.WithTimeout(context.GlobalDuration("connect-timeout"))
51+
opts = append(opts, timeoutOpt)
5052
client, err := containerd.New(context.GlobalString("address"), opts...)
5153
if err != nil {
5254
return nil, nil, nil, err

0 commit comments

Comments
 (0)