Because “an youghurt container” sounds wrong.
English has this thing where you know you wrote or pronounced something correct if it sounds right.