Will they take a cooler? Yes, they will, not a problem. We've done it many times for beach trips.
Is it the best idea to pack a couple of gallons of water in it? Not so much. If it leaks you can ruin a lot of folks' luggage, so PLEASE be extra careful. Line the cooler with heavy double garbage sacks before putting in the water, then put a few beach towels on top as absorbent, and knot the entire thing closed -- but not until AFTER you check it in at the counter. With coolers, the airline requires a visual inspection of the contents before they will accept it, because they won't allow perishables without special packaging.
Use a luggage strap to secure the outside of the cooler; taping isn't a good idea because TSA usually will not re-tape it in the event that they have to open the cooler for further inspection.