6. Given the sequence $\left\{a_{n}\right\}$ satisfies
$$
a_{n}=(\sqrt{2}+1)^{n}-(\sqrt{2}-1)^{n}(n \in \mathbf{N}) \text {. }
$$

Let $[x]$ denote the greatest integer not exceeding the real number $x$. Then the units digit of $\left[a_{2017}\right]$ is ( ).
(A) 2
(B) 4
(C) 6
(D) 8
6. A.

From the conditions, we have
$$
\left\{\begin{array}{l}
a_{n+2}=2 \sqrt{2} a_{n+1}-a_{n}, \\
a_{0}=0, \\
a_{1}=2 .
\end{array}\right.
$$
$$
\begin{array}{l} 
\text { Then } a_{2 k+1}=2 \sqrt{2} a_{2 k}-a_{2 k-1} \\
= 2 \sqrt{2}\left(2 \sqrt{2} a_{2 k-1}-a_{2 k-2}\right)-a_{2 k-1} \\
=7 a_{2 k-1}-2 \sqrt{2} a_{2 k-2} \\
= 7 a_{2 k-1}-\left(a_{2 k-1}+a_{2 k-3}\right) \\
= 6 a_{2 k-1}-a_{2 k-3} .
\end{array}
$$

Let $b_{k}=a_{2 k-1}$, hence $b_{k+1}=6 b_{k}-b_{k-1}$.
From the system of equations (1), we know $a_{2}=4 \sqrt{2}, a_{3}=14$, i.e.,
$$
b_{1}=2, b_{2}=14 \text {. }
$$

Thus, for any positive integer $k$, $b_{k} \in \mathbf{Z}$.
Notice that, $\left\{b_{k}(\bmod 10)\right\}$ is
$$
2,4,2,8,6,8,2,4, \cdots
$$

which is a periodic sequence with a period of 6.
Since $1009=6 \times 168+1$, we have
$$
b_{1009} \equiv 2(\bmod 10) \text {. }
$$

Therefore, the units digit of $\left[a_{2017}\right]$ is the remainder of $b_{1009}$ divided by 10, which is 2.