I put my pack into a plastic tube holder and ran the lead out the cap. Then I zip tied to the rack.
You can get more secure by buying a plastic project box from Radio Shack. Their online shows a 3x2x1 box with a screw on cover. I think that should fit the two cell pack you have. If not, they got larger size. Do you have a rack? If so you can drill some holes in the box and mount it to the rack with nuts and bolt or even bolt it to the slot on the rack mounting arms. Otherwise you can zip tie or hose clamp it to the frame.