Container terminal resources efficiency have been studied for many years, however, most researches focused on offline algorithms which are given the whole problem data from the beginning. Due to some unforeseen factors(such as bad weather, equipment failure), the predict information is not reliable, these make the planned difficult to implement, and reduce the efficiency of port operations. So we are based on the idea of online algorithms and propose a optimization model of berth container terminal and bridge crane resource, and give a online scheduling algorithm for solving. We also analyzed the smoothed competitive ratio by the smooth analysis. Through the experiments confirmed the algorithm feasibility.