The fluid mechanical aspects of the axisymmetric growth and collapse of a bubble in a narrow tube filled with a viscous liquid are studied numerically. The tube is open at both ends and connects two liquid reservoirs at constant pressure. The bubble is initially a small sphere and growth is triggered by a large internal pressure applied for a short time. After this initial phase, the motion proceeds by inertia. This model simulates the effect of an intense, localized, brief heating of the liquid which leads to the nucleation and growth of a bubble. The dimensionless parameters governing the problem are discussed and their effects illustrated with several examples. It is also shown that, when the bubble is not located at the midpoint of the tube, a net flow develops capable of pumping fluid from one reservoir to the other. The motivation for this work is offered by the possibility to use vapor bubbles as actuators in fluid-handling microdevices.