A 5.6 magnitude earthquake shook Bulgaria's capital Sofia early on Tuesday, causing residents to rush into the streets, the civil defence office said.