MCPcopy
hub / github.com/nektos/act / GetDockerClient

Function GetDockerClient

pkg/container/docker_run.go:218–240  ·  view source on GitHub ↗
(_ context.Context)

Source from the content-addressed store, hash-verified

216}
217
218func GetDockerClient(_ context.Context) (cli client.APIClient, err error) {
219 dockerHost := os.Getenv("DOCKER_HOST")
220
221 if strings.HasPrefix(dockerHost, "ssh://") {
222 var helper *connhelper.ConnectionHelper
223
224 helper, err = connhelper.GetConnectionHelper(dockerHost)
225 if err != nil {
226 return nil, err
227 }
228 cli, err = client.New(
229 client.WithHost(helper.Host),
230 client.WithDialContext(helper.Dialer),
231 )
232 } else {
233 cli, err = client.New(client.FromEnv)
234 }
235 if err != nil {
236 return nil, fmt.Errorf("failed to connect to docker daemon: %w", err)
237 }
238
239 return cli, nil
240}
241
242func GetHostInfo(ctx context.Context) (info system.Info, err error) {
243 var cli client.APIClient

Callers 11

removeExecutorFunction · 0.85
ImageExistsLocallyFunction · 0.85
RemoveImageFunction · 0.85
NewDockerBuildExecutorFunction · 0.85
GetHostInfoFunction · 0.85
connectMethod · 0.85
NewDockerPullExecutorFunction · 0.85
TestDockerFunction · 0.85

Calls 1

GetenvMethod · 0.65

Tested by 1

TestDockerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…