A function $f\colon\Bbb Q\to\Bbb Q$ is rational-continuous at a rational number $\alpha$ iff for any $\varepsilon > 0,$ there exists a corresponding $\delta$ based on $\alpha$ and $\varepsilon$ such that if $|\alpha-x| \leq \delta, |f(\alpha)-f(x)| \leq \varepsilon.$
It is easy to find a continuous function over the reals that satisfies $f(f(x)) = 2x.$ (Just take $f(x) = \sqrt{2}x.$) $\sqrt{2}$ is irrational, so we can't use this on the rationals, and I believe that any function continuous over the reals that gives a rational number when evaluated on a rational number cannot satisfy $f(f(x)) = 2x$. However, as we all know, rational-continuity is weird. A rational-continuous function can "jump around," unlike continuous functions over the reals. Is there a rational-continuous function (jumpy or not) that satisfies $f(f(x)) = 2x$?
Here's one way to do it which kind of side-steps the issue altogether.
$$f(x)=\begin{cases} -x & x\leq 0 \\ -2x & x>0 \end{cases} $$
The idea is just to use the fact composing $f$ twice lets you flip the real line around twice around the origin, and only multiply by $2$ on one of the halves.