This is an example of self discipline:
I'm on a diet. Keeping to my diet is "discipline".
Doing what your told and restraining yourself from doing something stupid or
a soldier who has a great deal of self discipline through years of intense exercise and training.