We know that there are about 3.785 liters in 1 gallon. From here we could pour 3 whole liters into a one-gallon container without overflowing since 3 < 3.285 liters. But if we try to pour the next whole liter( 4 liters) it would be too much since 4 is greater then 3.785 liters. So the answer is 3 liters.
Hope this helps. <3