fix(docker): improve error handling for missing Docker agent

Replaced panic with an error return in the NewClient
This commit is contained in:
yusing
2026-01-27 00:37:55 +08:00
parent df70f7f63c
commit d1c79acf87

View File

@@ -152,7 +152,7 @@ func NewClient(cfg types.DockerProviderConfig, unique ...bool) (*SharedClient, e
if agent.IsDockerHostAgent(host) {
a, ok := agentpool.Get(host)
if !ok {
panic(fmt.Errorf("agent %q not found", host))
return nil, fmt.Errorf("agent %q not found", host)
}
opt = []client.Opt{
client.WithHost(agent.DockerHost),