As the number of uncontrollable objects in low earth orbit is rising, the thread of collisions and thus the breakdown of working satellites becomes worth analyzing. Consequently, projects on removing objects from the important orbits are taken into account by the international space associations. This paper is about the modelling and optimal path planning of a docking maneuver to an uncontrollable tumbling target. After deriving the system dynamics, we introduce boundary conditions to ensure a safe and realizable maneuver and a general Bolza type cost functional to incorporate different optimization goals. In order to solve the resulting problem, we transform the dynamics to a set of differential algebraic equations which allow us to employ a direct optimization method while perserving the energy of the system. The concluding simulation results show the reliability and effectiveness of this approach.