For me food discipline comes from accepting one key point: food is for nutrition not recreation.
I'm cutting at the moment. I allowed myself to get up to around 19% body fat while I was bulking for weightlifting. Now I'm in the process of cutting back down to around my goal of 10% while trying to maintain as much muscle mass as possible. This has to be a slow process, definitely no more than 1kg per week of weight loss. I'm 3 weeks in now and I'm down 2.6kg.
I think there's a couple of key points:
1. Set your daily calories and stick to them. There are lots of calculators to figure out your base calorific requirements and the deficit needed to lose weight. For me that means going from 3000 cal/day down to 2400. If you go too low, your metabolism will shut down and you won't lose weight after a couple of weeks.
2. Get your protein/carb/fat levels right. There is an optimal range for each of these and there is a lot of research about it. Fats aren't evil, actually they are critical for testosterone and a number of other processes. Carbs aren't evil either. I'm currently shooting for 300g protein, 70g fat and 145g carbs per day. Timing is critical too and I avoid carbs and fat together. Morning is carbs, pre workout, during workout and after workout are carb meals. All other times are fat meals.
3. Have set meals. It's boring but it works. Every day, without fail I'm eating chicken and peanut butter for lunch. Before I exercise I'm eating chicken and brown rice. Before I go to bed I'm eating cottage cheese and whey. Yea it is repetitive and boring but it makes it easy to stick to.