Different jurisdictions have different requirements for the types of approved containers. In the USA (and in Canada, I presume) commercial plastic or metal containers designed and sold as “gasoline containers” can be used. (I used to use a one-gallon glass jug in a boat, for storage of gas to be used in a small outboard; I doubt if anyone would allow me to fill that at a gas station – the nozzle wouldn’t fit the bottle’s mouth, anyway – but it worked for that application.)
As others have said, put the can on the ground before and as you fill it, but they didn’t say the reason for that. Vehicles, and the fuel pump itself, can develop static electricity charges that will be dissipated if the can is on the ground and the pump is grounded as it should be. Otherwise, a spark can be generated between the fuel pump nozzle and the container on, say, the back of a pickup truck or the trunk of a car, and that is an explosion hazard with an “empty” gasoline container.
One fact about gasoline containers that a lot of people miss: It’s the empty ones that are the most dangerous. Gasoline is an explosive gas (vapor). It won’t actually burn “as a liquid” (if you’re going to experiment with that information, be very careful!), but an empty used gasoline container (or vehicle fuel tank) is filled with potentially explosive vapor. Also, as you fill the container or car tank, what comes out of that tank (displaced by the liquid) is… gasoline vapor. That is always an explosion hazard.