Alien has several similarities with Cube, and fits the OP's prompt. And in Alien, recall, the portion of the craft which is inhabited is quite small, and the cast (of Alien) are therefore trapped in a room/whereever, except when the decision is finally made to flee in a lifeboat, and only as a matter of absolute last resort. Similarly, Cube holds out the possibility of an escape (and one team member does manage to get out, technically), but in both cases the group have to work for it, rather hard.
Alien was released in 1979. Cube was released in 1997. Fun fact: /both 1979 and 1997 are prime numbers./ Prime numbers play an important role in Cube.
In both films, the characters are really set upon by the evil, opaque machinations of some faceless Company, out there, somewhere. The Company is the real antagonist.
In both films, a principal cast of seven are trapped in a large machine-structure, and killed off one-by-one by the titular manifestation of the above real threat of the Company: a space alien, and the booby traps in certain cubic rooms.
In both films...
The principal cast of both films: four white guys, a black guy, and two white women.
The first white guy to be killed is a famous "money-shot" of the film.
The second guy (the white guy) to be killed is the oldest of the group, screaming, shrieking.
Eventually, it is revealed that one of the stiff, unlikeable white guys is in fact a Company plant of sorts, who has certain information about the threat - although he himself is not terribly helpful.
One of the women is emotional, and fairly useless. The other is fairly competent, and is effectively the lead in the film.
The black guy is played as dumb muscle, makes sexual/power innuendo toward the women, and meets a particularly violent death toward the end.