Swarming in bounded domains