A homeless man is lucky to be alive after he was nearly crushed when the dumpster he was sleeping in was emptied into a garbage truck Thursday morning.

The man was curled up in the dumpster at Queen Street West and Ossington Avenue to stay warm when the truck picked it up and dumped the contents around 4:30 a.m.

The garbage truck driver, Chris Deakin,  heard banging coming from inside the container just before he started compacting the load.

“I heard a noise and I thought someone was up there [on a building balcony] complaining about the noise,” he said.

Then he heard banging from inside the truck, and a man yelling, “Get me out of here! Get me out of here!”

He jumped out and discovered that the man was inside, perilously close to being crushed.

The man was rescued and taken to hospital. He’s expected to be OK.

Deakin, who has been on the job for 22 years, says he’s discovered people sleeping in garbage bins before, but it’s the first time he’s actually dumped a person inside the truck.

“I think he’s very lucky,” he said.