Purpose - The purpose of this paper is to improve the efficiency of loading and discharging operations in container terminals. Accounting for an increase in the size of ships, the yard truck (YT) routing and scheduling problem has become an important issue to terminal operators. Design/methodology/approach - A (binary) integer programming model is developed using the time-space network technique to optimally move YTs between quay cranes (QC) and yard cranes (YC) in the time and space dimensions. The objective of the model is to minimize the total operating cost, and the model employs the M/M/S model in the queuing theory to determine the waiting time of YTs. The developed model can obtain the optimal number of YTs and their scheduling and routing plans simultaneously, as shown by the computational results. Findings - The results also show that the model can be applied to practical operations. In this research, an experimental design of the QC and YC operation networks was considered with the import and export containers carried by YTs. The model can be used to tackle a real world problem in an international port, and the analysis results could be useful references for port operators in actual practice. Research limitations/implications - The purpose of this research only focusses on YTs routing and scheduling problem, however, the container terminal operation problems are interrelated with berth allocation and yard stacking plan. The managerial application of this study is to analyze the trade-off between truck numbers and truck waiting time can be used for terminal operators to adjust the truck assignment. This research can assist an operator to determine the optimal fleet size and schedule in advance to avoid wasted costs and congestion in the quayside and yard block. Originality/value - This research solves the YT scheduling and routing problem for container discharging and loading processes with a time-space network model, which has not been previously reported, through an empirical research.