Skip to content

Commit

Permalink
Merge pull request #11206 from ndeloof/check_runtime
Browse files Browse the repository at this point in the history
introduce RuntimeVersion for code to check container runtime support
  • Loading branch information
glours authored Nov 20, 2023
2 parents cb01186 + 7cb1f8b commit a1b7bee
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,22 @@ func (s *composeService) isSWarmEnabled(ctx context.Context) (bool, error) {
}
})
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

}

0 comments on commit a1b7bee

Please sign in to comment.