Any Port in a Storm

What does the idiom “any port in a storm” mean?

Definition: If you’re in trouble, you’ll turn to anything that improves the situation.

Example: I’m not crazy about my job, but jobs are hard to find, and I’ve got bills to pay. Any port in a storm.