MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / NewClient

Function NewClient

agent/utils/docker/docker.go:38–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38func NewClient() (Client, error) {
39 var settingItem model.Setting
40 _ = global.DB.Where("key = ?", "DockerSockPath").First(&settingItem).Error
41 if len(settingItem.Value) == 0 {
42 settingItem.Value = "unix:///var/run/docker.sock"
43 }
44 cli, err := client.NewClientWithOpts(client.FromEnv, client.WithHost(settingItem.Value), client.WithAPIVersionNegotiation())
45 if err != nil {
46 return Client{}, err
47 }
48
49 return Client{
50 cli: cli,
51 }, nil
52}
53
54func NewClientWithExist(cli *client.Client) Client {
55 return Client{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected