We present a lattice Boltzmann study of the hydrodynamics of a fully resolved squirmer, confined in a slab of fluid between two no-slip walls. We show that the coupling between hydrodynamics and short-range repulsive interactions between the swimmer and the surface can lead to hydrodynamic trapping of both pushers and pullers at the wall, and to hydrodynamic oscillations in the case of a pusher. We further show that a pusher moves significantly faster when close to a surface than in the bulk, whereas a puller undergoes a transition between fast motion and a dynamical standstill according to the range of the repulsive interaction. Our results critically require near-field hydrodynamics and demonstrate that far-field hydrodynamics is insufficient to give even a qualitatively correct account of swimmer behaviour near walls. Finally our simulations suggest that it should be possible to control the density and speed of squirmers at a surface by tuning the range of steric and electrostatic swimmer–wall interactions.