There are a good many different solutions to this puzzle. Any contiguous pair, except 7-8, may be moved first, and after the first move there are variations. The following solution shows the position from the start right through each successive move to the end:--
. . 1 2 3 4 5 6 7 8 4 3 1 2 . . 5 6 7 8 4 3 1 2 7 6 5 . . 8 4 3 1 2 7 . . 5 6 8 4 . . 2 7 1 3 5 6 8 4 8 6 2 7 1 3 5 . .