Nightmares are not something you may have to live with. There are both pharmacological and psychotherapeutic options that may help reduce nightmares. The DBT and CBT protocols involve a combination of relaxation exercises, writing the nightmare out (with a different ending) and imagining the nightmare (with the new ending) before sleep and throughout the day.
If the nightmares are related to PTSD or a trauma event an additional option includes EMDR which is specifically designed to help those with traumatic memories eliminate or reduce the distress associated with the memories and change their thinking about the trauma. CBT and DBT also have trauma protocols but I find that EMDR is far more convenient for clients , just as effective and many elements of DBT and CBT can be incorporated into EMDR.
If you struggle with nightmares please speak to your doctor or therapist about options.