When properly maintained, a shipping container can last upwards of 30 years or longer. The lifespan largely depends on the environment as well as the condition of the container.
Although built to handle harsh climates, the lifespan of a shipping container is shortened by salty, wetter environments, such as those found in coastal regions. Minimizing exposure to moisture and salt will go a long way in adding years to the life of your container.
Ideally you want to keep the bottom of the container off the ground so that it isn’t sitting in damp conditions.