Use a tape measure to measure the cabinet door inside any molding, to determine the size of spice rack you will make.
Hold a piece of sheet metal against the cabinet door, and mark the four corners. Mark spots 1/2 inch down from the marks at the top corners and 1/2 inch up from the marks at bottom corners.
Measure your door for thickness before you drill the holes. Drill holes in the cabinet with a drill and a 1/4-inch drill bit. Screw the piece of sheet metal to the door. Use 1/4- to 1/2-inch screws, as cabinet doors are typically 3/4 inch thick.
Squeeze a small dot of metal epoxy onto the top of the metal lid of a tin container. Press a neodymium magnet onto the glue, and hold it down for several seconds to set the epoxy. Use a toothpick to scrape off any excess glue that may have leached from beneath the magnet. Add magnets to all the metal containers. Attach the tins to the sheet metal with the magnets.