<p>This study presents new observations of fine structure and motion of the bow shock formed in the solar wind, upstream of the Earth's magnetosphere. The NASA's MMS mission has recorded during 2 hours eleven encounters with an oscillatory shock, which moves with the speed of 4–17 km/s and has thickness of 130 km, or an ion gyroradius. The shock is formed by steepening of 1 mHz magnetosonic wave, creating compressional magnetic field and plasma density structures, which initiate a chain of cross-field current-driven instabilities that heat solar wind ions by the stochastic ExB wave energisation mechanism. The theoretical ion energisation limits are confirmed by observations. We have identified the ion acceleration mechanism operating at shocks and explained double beam structures in the velocity space. The nature of this mechanism has been revealed as a stochastic resonant acceleration (SRA). The results provide for the first time a consistent picture of a chain of plasma processes that generate collisionless shocks and are responsible for particles energisation.</p>