How and when did “jug” come to be a slang term for “prison”?

The OED’s first instance of jug meaning a prison occurs under “Stone-Jug” where, in 1796, in Grose’s Dictionary Vulgar T, “Stone-Jug” refers to “Newgate, or any other prison.” Under “jug” itself, the OED cites an 1861 poem in which the narrator was sentenced to “ten years in the Jug.”

https://english.stackexchange.com/questions/542663/how-and-when-did-jug-come-to-be-a-slang-term-for-prison