Facing frequent impacts from extreme weather such as tsunamis, storms and tropical cyclones, ports suffer from crises of operation shutdowns, shipping traffic jams, commuting obstacles and even manpower shortages. This research focuses on investigating how ports can enhance resilience through forming alliance from the perspective of dynamic evolutionary games. It explores the port's investment strategy, government guidance for port alliance, and shipping companies' decision to alleviate the damages from extreme weather attack, particularly with the consideration of stochastic risks. The study examines key factors including investment in resilience enhancement, port changing, vessel detentions, government subsidy and reputation. By analyzing the evolutionary process, evolutionary rate, stable states and stochastic disturbances, the research reveals the dominant strategies under various conditions, resilience enhancement priority, threshold condition for port changing, optimal subsidy strategy, and the impacts of various risks. The findings would offer valuable theoretical insights and practical guidance to port management.