🚨 Issue: env_file.0 must be a string error on Docker Compose < v2.24.0
📋 Summary
The current compose.yaml uses the object-based syntax for the env_file section, which causes an error on Docker Compose versions older than v2.24.0. These versions only accept env_file as a string or a list of strings, not objects.
🧪 Steps to Reproduce
- Use Docker Compose CLI version older than v2.24.0
- Run the command:
docker compose -f compose.yaml up -d
You will see the following error:
services.supra_cli.env_file.0 must be a string
💣 Problem Details
This snippet from compose.yaml:
env_file:
- path: ./supra-cli.env
required: false
is only supported on Docker Compose CLI v2.24.0 and above.
Older versions do not support the object format for env_file. They expect a string or list of strings, like this:
env_file:
- ./supra-cli.env
✅ Universal Solution (Compatible with All Docker Compose Versions)
Change the env_file section in your compose.yaml to:
env_file:
- ./supra-cli.env
This syntax works on all Docker Compose versions, including older ones.
🔧 Additional Information
- Affected versions: Docker Compose CLI < v2.24.0
- Root cause: Object-based
env_file syntax introduced in v2.24.0
- Impact: Prevents container startup on older Docker Compose versions
- Solution: Use string-based syntax for backward compatibility
📚 References
🚨 Issue:
env_file.0 must be a stringerror on Docker Compose < v2.24.0📋 Summary
The current
compose.yamluses the object-based syntax for theenv_filesection, which causes an error on Docker Compose versions older than v2.24.0. These versions only acceptenv_fileas a string or a list of strings, not objects.🧪 Steps to Reproduce
You will see the following error:
💣 Problem Details
This snippet from
compose.yaml:is only supported on Docker Compose CLI v2.24.0 and above.
Older versions do not support the object format for
env_file. They expect a string or list of strings, like this:✅ Universal Solution (Compatible with All Docker Compose Versions)
Change the
env_filesection in yourcompose.yamlto:This syntax works on all Docker Compose versions, including older ones.
🔧 Additional Information
env_filesyntax introduced in v2.24.0📚 References