isometry $f:X\to X$ is onto if $X$ is compact [duplicate]

Let $X$ be a compact metric space and $f\colon X\to X$ an isometry. For $x_0\in X$, consider the sequence $(x_n)$ given by $x_{n+1} = f(x_n)$ and let $x$ be a limit point of it (by compactness). Let $\varepsilon>0$. For some $n,m\in\mathbb N$ with $n<m$ we have $d(x_n,x)<\frac12\varepsilon$ and $d(x_m,x)<\frac12\varepsilon$, hence $d(x_n,x_m)<\varepsilon$. But then $d(x_0,f(X)) \le d(x_0,x_{m-n})=d(x_n,x_m)<\varepsilon$. Since $\varepsilon>0$ was arbitrary, we conclude $d(x_0,f(X))=0$, i.e. $x_0\in f(X)$.

If $X$ is not compact: For $X=\mathbb{R}_{>0}$, the map $x\mapsto x+1$ is an isometry.