The Messenger of Allah ﷺ ordered that dogs be killed, but granted an exemption for hunting dogs and dogs that guard sheep. He said, "When a dog drinks from a vessel, wash it seven times, and scrub it the eighth time with dust."
أخبرنا محمد بن عبد الأعلى الصنعاني قال حدثنا خالد حدثنا شعبة عن أبي التياح قال سمعت مطرفا
أن رسول الله ﷺ أمر بقتل الكلاب ورخص في كلب الصيد والغنم وقال إذا ولغ الكلب في الإناء فاغسلوه سبع مرات وعفروه الثامنة بالتراب
Muslim also narrated it in Sahih Muslim, Book of Purification, Chapter on the Ruling of a Dog's Licking, hadith (280), from the hadith of Khalid bin Harith, with this wording. It is also found in Al-Kubra, hadith (70).