Assuming that you have an even sided octagon:
Area of Octagon (A) = 4.828(a*a), where a = length of each side of the octagon
Volume of Octagon = Area (A) * Height (H)
So: Volume = 4.828(a*a)*H or 4.828(2"*2")*18" = 347.6 cu in
Since this is an aquarium site, I'll further assume you are looking for how much water the Oct will hold:
1 gallon = 231 cu in
So: Gallons = 347.6 cu in * 1g/231 cu in = 1.5 gallons (5.7 liters)