At roasting, coffee begins it's "staling process," which means the gases start escaping due to the complex chemical reactions caused by roasting.
Try an experiment. Take some roasted coffee beans and place the bag of beans in your car with the windows rolled up. Leave the coffee in the car,come back in an hour and
what does your car smell like? The gases that make the entire car smell like coffee are the gases that are escaping from the bean once the roasting process has taken place. In order to slow this process and keep the freshness in, we put the beans in the freezer in an airtight container. This can be a recycled plastic grocery bag, a ziplock bag or any type of plastic bag that keeps the beans away from the surface of the freezer.
In the freezer, ground coffee stays fresh for a week. Whole beans stay fresh for a month.