How to create a cylinder with a given circumference?
OK, I assume you need the box to stay the same size and want an octagon that has the right size or else Bastian's answer would be best. I also assume that you want a really clean result because one could simply scale around the cursor (with the cursor sitting on a vertex of the box and the box snapped to the box using the magnet), getting it roughly right and then zoom all the way in to do the fine adjustment.



I tried to use snapping while scaling it but somehow Blender steadily refuses to bend to my will. So I use a more predictable approach. 

I set the magnet to vertex and closest. Then I go into the editmode of the box, select the right face and duplicate it. I rotate the face by 45 degrees (R45Return) and then move it holding ctrl so the magnet snaps it to the edge of the box. It's sometimes easier to roughly position the face first without snapping so that Blender gets which verts are supposed to be closest. I repeat to snap rotated faces until I have the octagon. 

After that I hit remove doubles and fill the edgeloops and delete the inside face so the mesh stays manifold. I also select all verts and hit ctrl-N to recalc the normals



An array modifier would of course work, too.