There's a railroad. It can carry about 1,500 containers a day[1]. There are approximately 175,000 containers waiting to transit the canal, based on the 33,500 figure in the linked Wiki page and the 5 day wait.
Technically Panama's is the first transcontinental railroad, beating the Union Pacific by fourteen years. Panama's was running in 1855 while the line over the Sierra Nevada opened in 1869.
Transfer to truck/rail would also require a lot of seaport facilities which simply haven't been built in the area (it's designed as a canal, after all). You'd have to send the ships up to some container port on the Gulf of Mexico and ship them out via train to Los Angeles or someplace with capacity.
[1]: https://en.wikipedia.org/wiki/Panama_Canal_Railway#2001_reco...