{"record":{"id":"a8492c9d4467cbfb","repo":"slimtoolkit/slim","slug":"no-docker-info","errorCode":null,"errorMessage":"no docker info","messagePattern":"no docker info","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/docker/dockerclient/client.go","lineNumber":36,"sourceCode":"const (\n\tEnvDockerAPIVer      = \"DOCKER_API_VERSION\"\n\tEnvDockerHost        = \"DOCKER_HOST\"\n\tEnvDockerTLSVerify   = \"DOCKER_TLS_VERIFY\"\n\tEnvDockerCertPath    = \"DOCKER_CERT_PATH\"\n\tUnixSocketPath       = \"/var/run/docker.sock\"\n\tUnixSocketAddr       = \"unix:///var/run/docker.sock\"\n\tunixUserSocketSuffix = \".docker/run/docker.sock\"\n)\n\nvar EnvVarNames = []string{\n\tEnvDockerHost,\n\tEnvDockerTLSVerify,\n\tEnvDockerCertPath,\n\tEnvDockerAPIVer,\n}\n\nvar (\n\tErrNoDockerInfo = errors.New(\"no docker info\")\n)\n\nfunc UserDockerSocket() string {\n\thome, _ := os.UserHomeDir()\n\treturn filepath.Join(home, unixUserSocketSuffix)\n}\n\ntype SocketInfo struct {\n\tAddress       string `json:\"address\"`\n\tFilePath      string `json:\"file_path\"`\n\tFileType      string `json:\"type\"`\n\tFilePerms     string `json:\"perms\"`\n\tSymlinkTarget string `json:\"symlink_target,omitempty\"`\n\tTargetPerms   string `json:\"target_perms,omitempty\"`\n\tTargetType    string `json:\"target_type,omitempty\"`\n\tCanRead       bool   `json:\"can_read\"`\n\tCanWrite      bool   `json:\"can_write\"`\n}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/docker/dockerclient/client.go#L18-L54","documentation":"ErrNoDockerInfo is returned by the dockerclient constructors and command handlers (NewInteractiveApp, OnCommand, OnCopyCommand, OnImageIndexCreateCommand) when no Docker connection information can be derived from the environment. The client looks for standard DOCKER_* environment variables (host, TLS settings, API version, cert path) or the default Docker socket and fails when none are present.","triggerScenarios":"Calling any dockerclient command/constructor without DOCKER_HOST set and without /var/run/docker.sock present; environment missing EnvDockerHost/EnvDockerTLSVerify/EnvDockerCertPath/EnvDockerAPIVer variables.","commonSituations":"Running the tool outside a Docker context (no Docker Desktop/daemon installed); CI containers without the Docker socket mounted; env vars stripped when sudo is used; DOCKER_HOST pointing to a removed context so no info remains.","solutions":["Set DOCKER_HOST (e.g., unix:///var/run/docker.sock or tcp://host:2375) before running","Install/start the Docker daemon or Docker Desktop so the default socket exists","Mount the Docker socket into the container: -v /var/run/docker.sock:/var/run/docker.sock","If using TLS, set DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, and DOCKER_API_VER together","Re-run without sudo or with 'sudo -E' so DOCKER_* vars are preserved"],"exampleFix":"// before\nclient, err := dockerclient.New() // no env info\n// after\nos.Setenv(\"DOCKER_HOST\", \"unix:///var/run/docker.sock\")\nclient, err := dockerclient.New()","handlingStrategy":"validation","validationCode":"// Go: verify Docker connection info exists before creating a client\nhasInfo := os.Getenv(\"DOCKER_HOST\") != \"\" ||\n    func() bool { _, err := os.Stat(\"/var/run/docker.sock\"); return err == nil }()\nif !hasInfo {\n    return dockerclient.ErrNoDockerInfo // or surface a clear message\n}","typeGuard":"func IsNoDockerInfo(err error) bool {\n    return errors.Is(err, dockerclient.ErrNoDockerInfo)\n}","tryCatchPattern":"if err != nil {\n    if errors.Is(err, dockerclient.ErrNoDockerInfo) {\n        // prompt user to set DOCKER_HOST or start the Docker daemon\n    }\n    return err\n}","preventionTips":["Set DOCKER_HOST explicitly in CI and scripts","Mount /var/run/docker.sock when running inside containers","Avoid sudo stripping DOCKER_* variables (use sudo -E)","Ensure the Docker daemon is running before invoking the tool"],"tags":["docker","environment","missing-env-var","go"],"backgroundTag":"missing-docker-env","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}