Merge pull request #11206 from ndeloof/check_runtime

introduce RuntimeVersion for code to check container runtime support
This commit is contained in:
Guillaume Lours 2023-11-20 11:59:43 +01:00 committed by GitHub
commit a1b7bee094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -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
} }