This is a sardine can/tin: enter image description here Before the advent of tin cans folks apparently used "boxes" made of ceramic. But the term "box" is still used by some people to describe the above.

You can see how the metaphor might be used to describe people jammed tightly together.


Sardine can:

(US) a small car.

  • (1920) Eve. Capital News (Boise, ID) 4 Jan. 33/1: ‘Some sardine can you’re driving, Jeff’.

(GDoS)

The idea is that of a small space stacked with things or people like in:

be packed (in) like sardines:

To be very tightly or snugly packed together, especially in a small space.

  • We didn't want to take more than one car, so we had to be packed like sardines in Jeff's little sedan for the four-hour drive to Moab.

(MacGraw-Hill Dictionary of American Idioms and Phrasal Verbs.)