With the introduction of increasingly stringent carbon dioxide (CO2) emission regulations in the shipping industry, shipping companies face significant pressure to reduce emissions while ensuring profitable ship operations. A practical bi-objective speed optimization (BSO) algorithm for container ships is developed based on the variable weight idea, the discrete optimization idea, and the ideal point method to meet the urgent needs of shipping companies to improve operating profits and reduce emissions. By constructing two BSO models of ship main engine fuel consumption-ship sailing time and ship operating costs (SOC)-ship CO2 emissions (SCE), the effectiveness of the BSO algorithm is confirmed through extensive optimization experiments. The results show that compared to the historical sailing results, the BSO reduces the SOC by 4.43 % without causing a significant increase in the SCE, and reduces the SCE by 0.25 %. Moreover, the results demonstrate the effectiveness and feasibility of the BSO in reducing the cost of ship operations while reducing the impact on the environment. The results provide valuable references for shipping companies in the trade-off analysis between economic and environmental benefits and optimization decision-making.