Objective. This study aimed to investigate the possible mechanism of the Zhishi and Baizhu herb pair in the treatment of gastric cancer by means of network pharmacology and molecular docking and to provide a theoretical basis for experiments and clinical application of traditional Chinese medicine for treating gastric cancer. Methods. The main active chemical components of Zhishi and Baizhu were screened through Traditional Chinese Medicine Systems Pharmacology (TCMSP) database and selected by using the thresholds of oral bioavailability ≥30% and drug-likeness ≥18%. The targets of Zhishi and Baizhu were obtained from TCMSP, Therapeutic Targets Database (TTD), and the DrugBank database. The corresponding genes of the targets were retrieved from the UniProt database, and the gastric cancer targets were obtained from the GeneCards database and TTD. Subsequently, the networks were built between the main drug components, drug targets, and gastric cancer targets. Then, the enrichment analyses of GO and KEGG were applied to predict the potential roles of gastric cancer pathogenesis via the R package clusterProfiler. Finally, molecular docking was used to determine the affinity between the targets and components. Results. Twenty-seven main active components were predicted from the Zhishi-Baizhu herb pair, and a total of 120 intersection genes were screened from 303 potential medicine genes and 1,839 disease genes. The enrichment included the PI3K-Akt and IL-17 signaling pathways, and the network analysis showed that the Zhishi-Baizhu herb pair acted on seven key targets, namely, AKT1, MMP9, IL-6, CCND1, BCL2, MTOR, and MDM2 (where they played a role in treating gastric cancer). Molecular docking showed that luteolin and naringenin could stably bind to the targets. Conclusion. The possible mechanisms of the components of the Zhishi-Baizhu herb pair in treating gastric cancer might be related to luteolin and naringenin, which intervened with the targets AKT1, MMP9, IL-6, CCND1, BCL2, MTOR, and MDM2, and are linked with the PI3K-Akt and IL-17 signaling pathways. This knowledge will lay a solid foundation for further experimental and clinical studies.