The sea-rail intermodal port, serving as the “cornerstone” supporting the seamless connection of landside and quayside transportation, plays a crucial role in determining the service level of the container multimodal transport through port’s operational organization efficiency. With on-dock rails, the physical integration between railways and water transport is smoothly achieved. However, within the port, the diversity in container flows adds complexity to operational organization and decision-making. In this paper, we formulate a flexible crane scheduling model to reduce the mutual interference during the mixed operations of railway containers and road containers in the sharing yard. The model addresses the time window constraints of railway containers required by train schedule, and the uncertain scenarios of external truck arrivals. To solve this problem, we design a two-stage approach that encompasses a task reassignment phase and a sequential decision-making phase. Furthermore, we test the model and algorithm performance through various experiments of different scales. Our results show that the designed algorithm designed solves instances of 20 tasks in 18.7 s, compared to 3600 s for the model solver. It efficiently handles real-world instances with over 200 tasks and 100 scenarios. Finally, sensitivity analysis is carried out to capture the influence of railway container ratio, truck arrival patterns, and train time windows on yard operations. Under intensive operation, we find that road containers, following a uniform arrival pattern, are least affected by railway container operations when the proportion of railway containers in the sharing block ranges from 70% to 80%. We also observe that the flexibility of crane service increases as the time window for railway container operations becomes more lenient.