A father who threw beer cans at police officers protecting a hotel full of asylum seekers and was bitten by a police dog has been jailed for 30 months.