{"record":{"id":"37f584ba755a0f3a","repo":"slimtoolkit/slim","slug":"no-unix-socket-found","errorCode":null,"errorMessage":"no unix socket found","messagePattern":"no unix socket found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/docker/dockerclient/client.go","lineNumber":225,"sourceCode":"\n\t\tlog.Debug(\"dockerclient.New: new Docker client (TLS,no verify) [4]\")\n\n\tcase config.Env[EnvDockerHost] != \"\":\n\t\tclient, err = docker.NewClientFromEnv()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlog.Debug(\"dockerclient.New: new Docker client (env) [5]\")\n\n\tcase config.Host == \"\" && config.Env[EnvDockerHost] == \"\":\n\t\tsocketInfo, err := GetUnixSocketAddr()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif socketInfo == nil || socketInfo.Address == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"no unix socket found\")\n\t\t}\n\n\t\tif socketInfo.CanRead == false || socketInfo.CanWrite == false {\n\t\t\treturn nil, fmt.Errorf(\"insufficient socket permissions (can_read=%v can_write=%v)\", socketInfo.CanRead, socketInfo.CanWrite)\n\t\t}\n\n\t\tconfig.Host = socketInfo.Address\n\t\tclient, err = docker.NewVersionedClient(config.Host, config.APIVersion)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif config.APIVersion != \"\" {\n\t\t\tclient.SkipServerVersionCheck = true\n\t\t}\n\n\t\tlog.Debug(\"dockerclient.New: new Docker client (default) [6]\")\n","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/docker/dockerclient/client.go#L207-L243","documentation":"In New(), after GetUnixSocketAddr succeeds, the client defensively re-checks that the returned socketInfo is non-nil and has a non-empty Address before connecting; otherwise it returns \"no unix socket found\". This is an inconsistency guard: GetUnixSocketAddr already errors when nothing is found, so hitting this means discovery returned an empty/nil result without an error.","triggerScenarios":"Constructing a client with New (via NewInteractiveApp, OnCommand, OnCopyCommand, OnImageIndexCreateCommand, OnPullCommand, OnPushCommand) when GetUnixSocketAddr returns a nil SocketInfo or one with an empty Address string.","commonSituations":"Custom/patched socket discovery returning an empty result; unusual Docker installations where a probe succeeds structurally but yields no address; race where the socket disappears between detection and use.","solutions":["Treat like a missing Docker socket: verify the daemon socket exists and is discoverable (docker context ls / check /var/run/docker.sock).","Set the Docker host explicitly in config so discovery isn't relied upon.","Check GetUnixSocketAddr's candidate paths against your actual socket location and align (env var, symlink, or mount).","Update the library/version if your Docker layout (rootless, Docker Desktop) isn't covered by the probe list."],"exampleFix":"// before\nclient, err := dockerclient.New(&config.DockerClient{})\n// after\ncfg := &config.DockerClient{}\ncfg.Host = \"unix:///var/run/docker.sock\" // skip discovery if using non-default socket\nclient, err := dockerclient.New(cfg)","handlingStrategy":"fallback","validationCode":"if addr := os.Getenv(\"DOCKER_HOST\"); addr != \"\" {\n    cfg.Host = addr // bypass socket discovery entirely\n}","typeGuard":"func hasSocketAddress(info *dockerclient.SocketInfo) bool {\n    return info != nil && info.Address != \"\"\n}","tryCatchPattern":"cli, err := dockerclient.New(cfg)\nif err != nil && strings.Contains(err.Error(), \"no unix socket found\") {\n    cfg.Host = \"unix:///var/run/docker.sock\" // explicit fallback host\n    cli, err = dockerclient.New(cfg)\n}\nif err != nil {\n    return err\n}","preventionTips":["Set the Docker host explicitly via config or DOCKER_HOST instead of relying on discovery.","Keep the library updated so socket discovery covers rootless/Docker Desktop paths.","Symlink non-standard sockets to /var/run/docker.sock in constrained environments.","Log GetUnixSocketAddr's discovered info once at startup to detect empty results early."],"tags":["go","docker","socket","client-init"],"backgroundTag":"docker-socket-not-found","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}