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 ba4af8fe77
commit 730e3a2ab4

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),