The Messenger of Allah ﷺ said, "I had previously forbidden you from using certain containers, but a container does not make anything lawful or unlawful. Every intoxicant is forbidden."
حدثنا محمد بن بشار والحسن بن علي ومحمود بن غيلان قالوا حدثنا أبو عاصم حدثنا سفيان عن علقمة بن مرثد
قال رسول الله ﷺ إني كنت نهيتكم عن الظروف وإن ظرفا لا يحل شيئا ولا يحرمه وكل مسكر حرام
Reference. Muslim also narrated it, in the Book of Funerals, Chapter on the Prophet ﷺ Seeking Permission from His Lord — Glorified and Exalted — to Visit His Mother's Grave, hadith no. 977, from the hadith of Abu Asim Nabil, via the same chain.