Derivation of the lattice Boltzmann method from the continuous kinetic theory [X. He and L. S. Luo, Phys. Rev. E 55, R6333 (1997); X. Shan and X. He, Phys. Rev. Lett. 80, 65 (1998)] is extended in order to obtain boundary conditions for the method. For the model of a diffusively reflecting moving solid wall, the boundary condition for the discrete set of velocities is derived, and the error of the discretization is estimated. Numerical results are presented which demonstrate convergence to the hydrodynamic limit. In particular, the Knudsen layer in the Kramers' problem is reproduced correctly for small Knudsen numbers.