introduce RuntimeVersion for code to check container runtime supports required features
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
cb01186c2b
commit
7cb1f8baf2
|
|
@ -295,5 +295,22 @@ func (s *composeService) isSWarmEnabled(ctx context.Context) (bool, error) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return swarmEnabled.val, swarmEnabled.err
|
return swarmEnabled.val, swarmEnabled.err
|
||||||
|
}
|
||||||
|
|
||||||
|
var runtimeVersion = struct {
|
||||||
|
once sync.Once
|
||||||
|
val string
|
||||||
|
err error
|
||||||
|
}{}
|
||||||
|
|
||||||
|
func (s *composeService) RuntimeVersion(ctx context.Context) (string, error) {
|
||||||
|
runtimeVersion.once.Do(func() {
|
||||||
|
version, err := s.dockerCli.Client().ServerVersion(ctx)
|
||||||
|
if err != nil {
|
||||||
|
runtimeVersion.err = err
|
||||||
|
}
|
||||||
|
runtimeVersion.val = version.APIVersion
|
||||||
|
})
|
||||||
|
return runtimeVersion.val, runtimeVersion.err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue