Despite their obvious limitations, trains make great settings for movies.
Think of North by Northwest, where the wrongly charged and hunted Roger Thornhill (Cary Grant) successfully hides in the upper of a Pullman berth, while the porter makes up Eva Marie Saint's berth; the cool blond helping him hide. Or Some Like It Hot, where Genevieve (Tony Curtis) and Sugar Kane (Marilyn Monroe) throw a cocktail party—also in an upper berth. And, there's the near perfect The Lady Vanishes, with Margaret Lockwood, Michael Redgrave, and Dame May Whitty.
While these are great films, the claustrophobic confines of a train seem especially perfect for films noir. One of the best is The Narrow Margin from 1952, remade in 1990. In the 1952 version, Charles McGraw plays the tough-talking, unbribable Det. Sgt. Walter Brown, in a trench coat right out of Bogart's wardrobe. His job is to protect Mrs. Frankie Neall (Marie Windsor), who is planning to testify against the mob. They must go by train from Chicago to Los Angeles.