8. Place 8 balls with a radius of 2 in two layers in a cylindrical container, such that each ball is tangent to the four adjacent balls, and is also tangent to one base and the side of the cylinder. Then the height of the cylinder is $\qquad$ .
As shown in the figure, $A B C D$ is a square obtained by rotating $O_{1} O_{2} O_{3} O_{4}$ around the center $O$ by $45^{\circ}$,
$|A B|=4 \Rightarrow\left|O O_{1}\right|=|O A|=2 \sqrt{2}$, then $\left|A O_{1}\right|^{2}=8+8-2 \cdot 8 \cdot \frac{\sqrt{2}}{2}=16-8 \sqrt{2}$.
Thus, $\left|A O_{1}^{\prime}\right|^{2}=16-(16-8 \sqrt{2})=8 \sqrt{2}$ $\Rightarrow\left|A O_{1}^{\prime}\right|=\sqrt{8 \sqrt{2}}=2 \sqrt[4]{8}$.
Therefore, the height of the cylinder is $h=4+2 \sqrt[4]{8}$.