I just came across a Da'as Zekenim on the passuk speaking of Yosef's second dream. He brings a Medrash, which I found both as he brought it and also in a slightly different version. Presented here is a composite of the two Midrashim.
The passuk says in Yehoshua 10:12, "שמש בגבעון דום" - the Sun stood still in Givon.
Yehoshua commanded the Sun to stand still. The Sun responded and said, "Is it right for on older one to stand before a younger one? I was created on the fourth day of Creation. Man was created on the sixth!"
Yehoshua responded and said, "A young master can ask an old slave to do his bidding. You are my grandfather Yosef's slave, as the verse says, 'Behold the Sun and the Moon... were bowing down to me.'"
This Medrash is somewhat perplexing at first glance. Firstly, it was only a dream - the Sun did not actually bow down to Yosef. Secondly, the Sun clearly represented Yakov Avinu, as everyone involved in the story seemed to understand, hence we would think that the dream should not be taken literally.
It is clear from this Medrash that the dream had deeper implications, as we mentioned in a previous post. We see that the dream implied that the Sun and Moon and Stars literally bowed to Yosef.
This was what Yehoshua was saying - just as you bowed to Yosef, you must bow to me too, as I possess the power of Yosef, as Moshiach ben Yosef.
It is also significant that both the Sun and the Moon stood still. In regards to the stars, this story clearly occurred during the day, so the stars were not visible. Nevertheless, they also stood still for the observers on the other side of the world. Thus, all the characters in Yosef's dream showed their subservience to Yehoshua, Yosef's great-grandson. May we merit to soon see them show their subservience to Moshiach ben Yosef again.