-
Notifications
You must be signed in to change notification settings - Fork 61
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
Syntax simplifications to reduce the config file code #162
Comments
I am ignoring your first request, since it's indeed not a "shortcut". About the As for the plural/singular, even though I see your point, the idea is to map 1-1 Docker CLI options, so I am not sure introducing support for both would really help - I think #116 is a better way out. |
Well, I see to write I've tried to figure out how to avoid the But I think you have ignored the most important. To have the ability to declare more than one container for one declaration avoiding to repeat your self. And for that, the merging feature of YAML is on the recue! For example, in my case I have a dockerfile defining a container that simply runs a java application with a given parameter passed through
And about the plural/singular, I also think the best option would be to warn the user when he uses unknown params. Thanks again! PD: I'll try in a few dates to make a PR to add to the README some examples using these features of YAML. |
I created a PR with an example of advance use of YAML (#165) |
I have a config file with several containers and I see some repeated extra code. I have seen a lot of
crane.yml
files that people are actually using in github projects, and I've seen it's not only my case.The first and easier thing is that there are lots of cases with
link
declarations where the container's name and its alias are the same. And I think in that cases the alias could be omitted. For example"db:db"
could be simply"db"
.In fact, it's the same case than the ports where you can use the(Oops, I've just learnt there is a difference between them…)"80:80"
or"80"
declaration without distinction.The second one, well I think it would be difficult to avoid. I've seen almost every container has the declaration
detach: true
. Maybe more than the 80% of the containers have this. So I was wondering if it would be better to set it to true as default. But I think it would be difficult for retrocompatibility reasons.Finally, if I want to declare N instances for the same service (i.e. N containers with the same specification) I have to copy and paste N times (AFAIK). It's very common when you need to deploy a load balancer. I think it could be interesting to declare it only once and indicate the number in it. Some possibilities:
or
And then they would be automatically named as
web1
,web2
andweb3
, for example.Bonus: it's not for reducing the code, but shouldn't be
volumes
andlinks
instead ofvolume
andlink
? In deed, they are arrays. Accepting both (singular and plural) could avoid some misunderstanding initial errors for people like me that come from Fig and Docker-Compose. The first time I executed crane it took me more than 10 minutes to figure out why the volumes weren't been mounted correctly. And it was simply because I wrotevolumes
and the crane compiler didn't show any warning.The text was updated successfully, but these errors were encountered: