MCPcopy
hub / github.com/cortexlabs/cortex / GetDockerClient

Function GetDockerClient

pkg/lib/docker/docker.go:59–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59func GetDockerClient() (*Client, error) {
60 if _cachedClient != nil {
61 return _cachedClient, nil
62 }
63
64 baseClient, err := dockerclient.NewClientWithOpts(dockerclient.FromEnv)
65 if err != nil {
66 return nil, WrapDockerError(err)
67 }
68
69 baseClient.NegotiateAPIVersion(context.Background())
70
71 info, err := baseClient.Info(context.Background())
72 if err != nil {
73 return nil, WrapDockerError(err)
74 }
75
76 _cachedClient = &Client{
77 Client: baseClient,
78 Info: info,
79 }
80
81 return _cachedClient, nil
82}
83
84func MustDockerClient() *Client {
85 dockerClient, err := GetDockerClient()

Callers 9

validateDockerImagePathFunction · 0.92
runManagerFunction · 0.92
cluster.goFile · 0.92
MustDockerClientFunction · 0.85
AWSAuthConfigFunction · 0.85
PullImageFunction · 0.85
StreamDockerLogsFunction · 0.85
CopyToContainerFunction · 0.85
CopyFromContainerFunction · 0.85

Calls 1

WrapDockerErrorFunction · 0.85

Tested by

no test coverage detected