That all depends on what you want to get out of your training. If you’re looking to get a high heart rate and lactate, intervals are good, in which case you don’t need to run for very long on the treadmill.
A normal high intensity interval workout is usually between 20-40 minutes, including warming up. If you want to build up your fitness, we recommend a speed at which it becomes difficult for you to have a conversation during your workout, but below the limit for developing lactate. The right length of such a run is around 30-45 minutes, depending on how used to running you are.
If you’re really out of practice at running, we recommend starting slowly so your body has a chance to get used to it. 10-15 minutes at a leisurely pace may suffice the first few times. If you're an experienced runner, you can extend your workout to 60-75 minutes or maybe even longer if your body feels good.