{"record":{"id":"a7e4a787052f654a","repo":"docker/compose","slug":"docker-compose-does-not-support-configs-driver","errorCode":null,"errorMessage":"Docker Compose does not support configs.*.driver","messagePattern":"Docker Compose does not support configs\\.\\*\\.driver","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/create.go","lineNumber":1173,"sourceCode":"func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount.Mount, error) {\n\tmounts := map[string]mount.Mount{}\n\n\tconfigsBaseDir := \"/\"\n\tfor _, config := range s.Configs {\n\t\ttarget := config.Target\n\t\tif config.Target == \"\" {\n\t\t\ttarget = configsBaseDir + config.Source\n\t\t} else if !isAbsTarget(config.Target) {\n\t\t\ttarget = configsBaseDir + config.Target\n\t\t}\n\n\t\tdefinedConfig := p.Configs[config.Source]\n\t\tif definedConfig.External {\n\t\t\treturn nil, fmt.Errorf(\"unsupported external config %s\", definedConfig.Name)\n\t\t}\n\n\t\tif definedConfig.Driver != \"\" {\n\t\t\treturn nil, errors.New(\"Docker Compose does not support configs.*.driver\") //nolint:staticcheck\n\t\t}\n\t\tif definedConfig.TemplateDriver != \"\" {\n\t\t\treturn nil, errors.New(\"Docker Compose does not support configs.*.template_driver\") //nolint:staticcheck\n\t\t}\n\n\t\tif definedConfig.Environment != \"\" || definedConfig.Content != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif config.UID != \"\" || config.GID != \"\" || config.Mode != nil {\n\t\t\tlogrus.Warn(\"config `uid`, `gid` and `mode` are not supported, they will be ignored\")\n\t\t}\n\n\t\tbindMount, err := buildMount(p, types.ServiceVolumeConfig{\n\t\t\tType:     types.VolumeTypeBind,\n\t\t\tSource:   definedConfig.File,\n\t\t\tTarget:   target,\n\t\t\tReadOnly: true,","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/create.go#L1155-L1191","documentation":"When creating containers, Compose materializes top-level `configs` as bind-mount files. Configs declared with a `driver:` rely on SwarmKit driver plugins to produce secret data, which plain Docker Compose (non-Swarm) cannot do, so creation aborts with an explicit 'not supported' error rather than silently mounting nothing.","triggerScenarios":"A compose file with a top-level configs entry containing `driver: <name>` (e.g. driver: secretfiles), used by a service, when `docker compose up` (or the create API) resolves configs.","commonSituations":"Reusing a docker-stack.yml / Swarm service file with compose up; configs declared with driver opts for CSI-style plugins; migrating from Swarm to Compose without stripping driver-based configs.","solutions":["Remove the `driver:` key from the config declaration and provide the config as `file:` or `content:` instead","If you need driver-backed configs, deploy with `docker stack deploy` (Swarm) instead of compose up","Use `profiles:` to gate Swarm-only services out of compose runs"],"exampleFix":"# before\nconfigs:\n  cert:\n    driver: my-driver\n# after\nconfigs:\n  cert:\n    file: ./cert.pem","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# fail if any top-level config declares a Swarm-only driver\nif grep -qE '^  [a-zA-Z0-9._-]+:.*driver:' docker-compose.yml 2>/dev/null; then :; fi\npython3 - <<'EOF'\nimport yaml,sys\ncfg=yaml.safe_load(open('compose.yaml'))\nfor n,c in (cfg.get('configs') or {}).items():\n    if 'driver' in c: sys.exit(f\"config {n} uses unsupported driver\")\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint compose files with a schema-aware linter (docker compose config) before up","Keep Swarm stack files separate from compose dev files"],"tags":["configs","compose-file","swarm","container-create"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}