Best to work backwards. Start with an extension $K\supset\mathbb Q$ whose G-group you know to be $D_8$. Let $\xi$ be a primitive element of $K$, then the minimal polynomial for $\xi$ over $\mathbb Q$ is octic, irreducible, and all of its roots, just as well as any one of them, generate(s) $K$ over $\mathbb Q$.
You expect that for squarefree $n$, the Galois closure of $\mathbb Q(\root4\of n)$, which you get by adjoining $i$ as well, will have $D_8$ for the G-group. Calling $\rho=\root4\of n$, almost any linear combination of $\rho$ and $i$ will be a primitive element. For instance, for $n=2$, you get the minimal polynomial of $\xi=\rho+i$ to be $X^8 +4X^6 +2X^4+28X^2+1$. I confess that I have not checked the irreducibility of this directly.