Every day is a school day. Did you know shaving foam cans, shaving gel cans and even deodorant cans are all recyclable. I imagine most people use shaving foam/gel on a fairly regular basis. Do you recycle yours? I certainly haven't been over the last 'cough' many years of my adult life.
However I try to use recycling as a last resort. I try to rethink my purchases and reduce my consumption. Last year my husband bought me a present! He is awesome at getting me useful, practical and eco friendly things. He had brought me a shaving soap bar. The packaging so so minimal - the cardboard box it was in was made from recycled paper and was also recyclable.
The other benefit to the shaving soap bar is that is is made from natural ingredients and doesn't contain palm oil, preservatives or sulphates. And it doesn't need any gas to act as a propellant to get the gel/foam out of the container.
Have a look around and see what options you can find. My husband swears by shaving cream. A tub will last him just over a year and he uses an old fashioned brush with it. Its still in a plastic tub but its so much less packaging in comparison to the cans of shaving gel. And the tub is lovely so gets reused...usually in his workshop for screws/nails etc. When he's finished this tub he will move on to a shaving soap bar too.