-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate Compose file and produce better error messages #129
Comments
fig.yml
The port should be in the format:
|
Have we considered designing a custom syntax that enforces this stuff at a syntactic level? Perhaps something like
|
I'm happy to put together a proposed implementation if yall think this is a direction we'd like to go. |
Appealing - but personally, I'd much rather maintain a few lines of validation code than a custom language grammar + parser, as flawed as YAML is. On Sat, Aug 9, 2014 at 11:26 AM, Jeanine Adkisson
|
Ok. My feeling is that validation is not going to be anywhere near complete with just a few lines, and parsing is not actually that hard, especially for such a dirt-simple grammar. But it's your call. |
Oh, and it'd probably just be a small amount of pyparsing, not a whole flex/bison stack or something, that would indeed be way overkill. |
... and in terms of being a tool for humans, we would do well to make the format obvious by design, which yaml doesn't really accomplish. But yes, I will actually stop talking about this now. |
👎 on introducing a new grammar. It would break backwards compatibility and YAML is a pretty universal format. We actually do things with our fig.yml in our deployment tooling for example. I don't want to have to build a parser into our deployment tooling. YAML is flexible enough that we don't have to update the grammar as we introduce new features. It just requires that we check the data types for the keys we want to use. |
As a user of fig, I also would prefer the YAML. In my experience there is very rarely need for something beyond a simple structured configuration using a standard format (JSON, YAML, XML (ugh!), etc.). |
http://colander.readthedocs.org/en/latest/ might be a decent option for validating the config. It validates a schema on the python side so it doesn't tie you to yaml. I've used it before without many complaints. |
How do we specify :ro to the fig.yml for volumes |
Spot the bug:
Result is:
|
#442 would "fix" this (kind of). I guess it should add a check to make sure that the 3rd part is either |
@aanand, Is there any consensus on the best way to implement the validation? I wanted to check first before I give it a shot. |
Not at all consensus, but I have been thinking that |
@draghuram what's your status on this? maybe i will have the time to take care of this within the next days. |
@funkyfuture As you can see, I created a PR with all the work that I have done. Basically, there is a JSON schema file and code to validate the configuration against that. At some point, I was able to run all the tests successfully but that was some time back. I think there are two more things that need to be done:
Please feel free to build on top of this PR as I may not be able to spend time on this issue. |
+1 to keeping yaml |
I majority of these concerns should now be covered/addressed by #1808 |
Could it be more strict? Perhaps allowed values for keys such as restart? Lately i was investigating why one of my containers isn't restarting, when others do. I looked at my yaml file and everything was ok. Except for a typo i didn't see ;)
You can type whatever you want as a value and nothing stops you from running containers this way. Using docker-compose version 1.6.2 |
Accepted values for |
Doesn't sound like I'll be able to put
Maybe this env variable limitation could be mentioned in: |
Handle start errors sync with runc
I continue to get this error message on windows. ERROR:
docker-compose.yaml/yml file is in the directory mentioned. docker and docker compose versions are shown below. someone please help me at the earliest docker --version docker-compose --version |
There are a lot of ways to confuse Compose with a badly-formed
docker-compose.yml
. This file should be checked when it is read and good error messages should be produced to help users fix the problem.This could be done by producing a schema for the file, like was done in #1348.
These sorts of things should be checked:
image
) - are numbers allowed? When? Don't accept YAML's eager interpretation of values (e.g.true
) which should be quoted (docker-compose does not pass environment variables true/false unchanged #1788)volumes
) either must be a list, or we helpfully wrap single values in a list for youcommand
,entrypoint
)environment
)volumes
- see Error when specifying permission in volume #260)References: #117 #127
The text was updated successfully, but these errors were encountered: