1744 (in a recollection from c. 1710), "store in a military camp," from French cantine "sutler's shop" (17c.), from Italian cantina "wine cellar, vault," diminutive of canto "a side, corner, angle." Thus it is perhaps another descendant of the many meanings that were attached to Latin canto "corner;" in this case, perhaps "corner for storage." A Gaulish origin also has been proposed.
Sense of "refreshment room at a military base" (1803) was extended to schools, etc. by 1870. Meaning "small tin for water or liquor, carried by soldiers on the march, campers, etc." is from 1744, from a sense in French.