Why do dogs eat their own poop sometimes?

Dogs may sometimes eat their own poop as their poop will still contain nutrients that they need. To combat this, one can feed them a diet that contains the nutrients they need.