Docker Compose build must be a string, in CI
Docker Compose build must be a string is the schema validator naming one branch of a rule with two, and following it literally will send you to rewrite a mapping that was never the problem. Compose accepts a path string or a mapping under build , and the message picks the first branch it checked rather than listing both. The schema allows a string or a mapping. Both branches fail, both are…
Docker Compose build must be a string is an error that occurs when the value under the build key is not a string or a mapping. This rule applies when running docker compose build, docker compose config, or docker compose up --build. The error message indicates the key and the type that is invalid. The mapping branch of the rule is also invalid, but it is not specifically mentioned in the error message.
The error can be caused by various issues such as a stray dash turning a mapping into a list or a key with no value. It is recommended to validate the Compose files in CI before building, use an editor with a Compose schema, quote values written by a generator, and remove keys with empty values.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.