When running docker compose ps or docker-compose top on a file with lots of environment variables, expanded via a local .env file on build, the linting of the file fails like this.
error while interpolating services.app.read_only: failed to cast to expected type: invalid boolean:
The raw value is a string, because it expands to true or false on build.
It seems that the value of the read_only variable is a string that expands to either true or false on build. However, Docker Compose is expecting a boolean value, not a string.
To fix this issue, you can explicitly cast the read_only value to a boolean in your Docker Compose file using the !!bool tag. For example:
This will ensure that the READ_ONLY environment variable is interpreted as a boolean, regardless of its value.
Alternatively, you can modify the format of the environment variable to use the YAML boolean format instead of a string that expands to a boolean. For example: