crowdsecurity/crowdsec · error

no containers or services configuration provided

Error message

no containers or services configuration provided

What it means

Validation guard in the docker datasource's UnmarshalConfig: after strict YAML parsing, neither a container configuration (container_name, container_id, and regexp variants) nor a service configuration (service_name, service_id, and variants) is present. The docker source has nothing to watch, so the config is rejected.

Source

Thrown at pkg/acquisition/modules/docker/config.go:69

}

func (d *Source) UnmarshalConfig(yamlConfig []byte) error {
	d.Config = Configuration{
		FollowStdout: true, // default
		FollowStdErr: true, // default
	}

	if err := yaml.UnmarshalWithOptions(yamlConfig, &d.Config, yaml.Strict()); err != nil {
		return fmt.Errorf("while parsing DockerAcquisition configuration: %s", yaml.FormatError(err, false, false))
	}

	if d.logger != nil {
		d.logger.Tracef("DockerAcquisition configuration: %+v", d.Config)
	}

	// Check if we have any container or service configuration
	if !d.Config.hasContainerConfig() && !d.Config.hasServiceConfig() {
		return errors.New("no containers or services configuration provided")
	}

	if d.Config.UseContainerLabels && (len(d.Config.ContainerName) > 0 || len(d.Config.ContainerID) > 0 || len(d.Config.ContainerIDRegexp) > 0 || len(d.Config.ContainerNameRegexp) > 0) {
		return errors.New("use_container_labels and container_name, container_id, container_id_regexp, container_name_regexp are mutually exclusive")
	}

	if d.Config.UseServiceLabels && (len(d.Config.ServiceName) > 0 || len(d.Config.ServiceID) > 0 || len(d.Config.ServiceIDRegexp) > 0 || len(d.Config.ServiceNameRegexp) > 0) {
		return errors.New("use_service_labels and service_name, service_id, service_id_regexp, service_name_regexp are mutually exclusive")
	}

	if d.Config.CheckInterval != "" && d.logger != nil {
		d.logger.Warn("check_interval is ignored: this datasource now uses events instead of polling (will be removed in a future version)")
	}

	if d.Config.Mode == "" {
		d.Config.Mode = configuration.TAIL_MODE
	}

View on GitHub (pinned to 909b515798)

Solutions

  1. Add at least one container selector, e.g. container_name: [my-app], or a service selector like service_name: [web]
  2. For swarm deployments use the service_* fields; for plain docker use container_* fields
  3. Remember docker is the only source that may omit labels, but it still requires a selector
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/docker/config.go:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/b35c10cc06283c47. Report an issue: GitHub.