During the operation of crane system in container yard, the objective is to transport the load to a goal position as quick as possible without rope oscillation. The container crane is generally operated by an expert operator, but recently an automatic control system with high speed and rapid transportation is required. Therefore, we developed an optimal controller which has to control the crane system with disturbances. In this paper, we present a design of optima 2-DOF PID controller for the control of gantry crane which has to control swing motion and trolley position. We used evolution strategy(ES) to tune the parameters of 2-DOF PID controller. It was compared with general PID controller. The computer simulations show that the proposed method has better performances than the other method.