{"record":{"id":"2b9ae15a3f1c7553","repo":"crowdsecurity/crowdsec","slug":"failed-to-get-docker-info-w","errorCode":null,"errorMessage":"failed to get docker info: %w","messagePattern":"failed to get docker info: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":175,"sourceCode":"\n\td.logger.Tracef(\"Actual DockerAcquisition configuration %+v\", d.Config)\n\n\topts := []client.Opt{\n\t\tclient.FromEnv,\n\t}\n\n\tif d.Config.DockerHost != \"\" {\n\t\topts = append(opts, client.WithHost(d.Config.DockerHost))\n\t}\n\n\td.Client, err = client.New(opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinfo, err := d.Client.Info(ctx, client.InfoOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get docker info: %w\", err)\n\t}\n\n\tif info.Info.Swarm.LocalNodeState == dockerTypesSwarm.LocalNodeStateActive && info.Info.Swarm.ControlAvailable {\n\t\thasServiceConfig := d.Config.hasServiceConfig()\n\t\tif hasServiceConfig {\n\t\t\td.isSwarmManager = true\n\t\t\td.logger.Info(\"node is swarm manager, enabling swarm detection mode\")\n\t\t}\n\n\t\tif !hasServiceConfig {\n\t\t\t// we set to false cause user didnt provide service configuration even though we are a swarm manager\n\t\t\td.isSwarmManager = false\n\t\t\td.logger.Warn(\"node is swarm manager, but no service configuration provided - service monitoring will be disabled, if this is unintentional please apply constraints\")\n\t\t}\n\t}\n\n\td.backoffFactory = newDockerBackOffFactory()\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L157-L193","documentation":"During Configure, the docker source queries the Docker daemon with client.Info to determine whether the node is an active Swarm manager. If the daemon call fails (daemon unreachable, socket permission denied, Docker not installed), configuration is aborted with this wrapped error.","triggerScenarios":"Configure called with d.Client whose Info(ctx, client.InfoOptions{}) request fails: docker daemon down, wrong DOCKER_HOST, unix socket not accessible, or no docker API client configured at all.","commonSituations":"CrowdSec running in a container without the docker socket mounted; user not in the `docker` group; DOCKER_HOST pointing at a dead host/port; Docker Desktop not running on the machine.","solutions":["Verify the docker daemon is running: `docker info` must succeed as the same user.","Check/fix the `docker_host` config or DOCKER_HOST env (unix:///var/run/docker.sock or tcp://host:2375).","Mount /var/run/docker.sock into the CrowdSec container and grant read/write, or add the user to the `docker` group.","If using tcp, ensure the API port is exposed and reachable (and TLS certs are valid if enabled)."],"exampleFix":"// before (acquis.yaml)\nsource: docker\n// after — explicit reachable host\nsource: docker\ndocker_host: unix:///var/run/docker.sock","handlingStrategy":"try-catch","validationCode":"// shell preflight\ncmd := exec.Command(\"docker\", \"info\")\nif err := cmd.Run(); err != nil {\n    return errors.New(\"docker daemon not reachable for this user/host\")\n}","typeGuard":null,"tryCatchPattern":"if err := src.Configure(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to get docker info\") {\n        log.Fatalf(\"docker daemon unreachable: %v — check docker_host and socket permissions\", err)\n    }\n    return err\n}","preventionTips":["Run `docker info` as the same user CrowdSec runs as, before starting it.","Mount /var/run/docker.sock or configure a reachable tcp docker_host.","Add the crowdsec user to the docker group or grant socket capabilities in containers."],"tags":["docker","network","daemon"],"backgroundTag":"connection-refused","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}