{"record":{"id":"e6af9bf14774d235","repo":"docker/compose","slug":"docker-compose-does-not-support-configs-template","errorCode":null,"errorMessage":"Docker Compose does not support configs.*.template_driver","messagePattern":"Docker Compose does not support configs\\.\\*\\.template_driver","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/create.go","lineNumber":1176,"sourceCode":"\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,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":1158,"sourceCodeEnd":1194,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/create.go#L1158-L1194","documentation":"`template_driver` on a config tells SwarmKit to run a plugin that templates the config content before delivery (a Swarm-only feature). Compose has no equivalent when it converts configs into bind mounts, so container creation fails with this explicit unsupported-feature error.","triggerScenarios":"Top-level configs entry with `template_driver: <driver>` referenced by a service during `docker compose up`/create.","commonSituations":"Swarm-style golang-templated configs (e.g. template_driver: golang) reused under compose; stack files ported from Swarm; CI that validates the same file with both engines.","solutions":["Remove `template_driver:` and inline the final content via `content:` (or pre-render the template yourself into a `file:`)","Keep a separate compose file without template drivers for local dev, sharing anchors for the rest","Deploy the stack with `docker stack deploy` where template drivers are supported"],"exampleFix":"# before\nconfigs:\n  nginx-conf:\n    template_driver: golang\n    file: ./nginx.tmpl\n# after\nconfigs:\n  nginx-conf:\n    file: ./nginx-rendered.conf","handlingStrategy":"validation","validationCode":"python3 - <<'EOF'\nimport yaml,sys\ncfg=yaml.safe_load(open('compose.yaml'))\nfor n,c in (cfg.get('configs') or {}).items():\n    if 'template_driver' in c: sys.exit(f\"config {n} uses unsupported template_driver\")\nprint('ok')\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `docker compose config` in CI to catch unsupported keys early","Pre-render templated configs in your build step instead of relying on Swarm drivers"],"tags":["configs","compose-file","swarm","container-create"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}