Let $G$ be a group of order 8 - you want to show that $G$ is one of the ones you mentioned. The proof is a little long, but it breaks down into the following cases :
- If $G$ is abelian, $G$ must be isomorphic to a product of cyclic groups. These can only be $C_8, C_2\times C_4,$ or $C_2\times C_2\times C_2$
- If $G$ is non-abelian :
a) Not all elements of $G$ have order 2 (because then $(ab)^2 = a^2b^2$ for all $a,b\in G$, which would imply that $G$ is abelian).
b) $G$ does not have an element of order 8.
c) Hence, we can choose $b\in G$ of order $4$, and let $H = \langle b \rangle$. Then $[G:H]=2$, so $H$ is normal in $G$. Write $G/H = \{H, aH\}$
d) Let $K = \langle a \rangle$.
i) If $|K| = 2$, then $H\cap K = \{e\}$, so $G\cong H\times_{\tau} K$ for some non-trivial automorphism $\tau : K\to Aut(H)$. This would give the case $G\cong D_4$
ii) If $|K| = 4$, then $H\cap K = \{e,a^2\}$. This gives the case $G\cong Q_8$
- Finally, you need to show that $D_4\ncong Q_8$.