The Casimir force due to a massless scalar field satisfying Dirichlet boundary conditions may draw a piston into the neck or toward the bulb of a flasklike container. In the worldline formalism this is due to competing contributions to the interaction energy from two types of Brownian bridges. Geometrical subtractions define a finite interaction energy. The procedure does not require regularization and appears well suited for numerical studies. The worldline analysis is robust with respect to variations in the shape of both piston and flask.