Docker Community Forums

Share and learn in the Docker community.

Getting invalid compose file error because of invalid type

I using version 3.7. I get the following error when running my up command:

The Compose file ‘..\x.yml’ is invalid because:
volumes.w contains an invalid type, it should be a string or a number
volumes.x contains an invalid type, it should be a string or a number
volumes.y contains an invalid type, it should be string or a number
volumes.z contains an invalid type, it should be a string or a number

All volumes causing the errors are in my #‘volumes’ service definition.

Obviously your compose.yml does not pass the schema validation.
Do you have any idea why this is?

I do not know why, when I put the file in to validation tools it passes.

I’ve run some validation tools across my yml, with no errors.

valid yaml does not necessarirly mean that your yaml configuration is valid against the schema docker expects.