As one of main challenge for carriers, empty container repositioning is subject to various uncertain factors in practice, which causes more operation costs. At the same time, the movements of empty containers can result in air pollution because of the CO2 emission, which has a negative impact on sustainable development. To incorporate environmental and stochastic characteristics of container shipping, in this paper, an empty container repositioning problem, taking into account CO2 emission, stochastic demand, and supply, is introduced in a sea–rail intermodal transportation system. This problem is formulated as a chance-constrained nonlinear integer programming model minimising the expected value of total weighted cost. A sample average approximation method is applied to convert this model into its deterministic equivalents, which is then solved by the proposed two-phase tabu search algorithm. A numerical example is studied to conclude that the stochastic demand and supply lead to more repositioning and CO2 emission-related cost. Total cost, inventory cost, and leasing cost increase with the variabilities of uncertain parameters. We also found that the total cost and other component costs are strongly dependent on the weights of repositioning cost and CO2 emission-related cost. Additionally, the sensitivity analysis is conducted on unit leasing cost.