Nearly all life is found in the oceans (maximum depth of 11 km), and within about a kilometre beneath the Earth's surface. Life has adapted to survive in practically all places on Earth, whether at the poles, or in arid desert at the equator, high in the mountains, or underground. This thin veneer of the surface of the planet is the biosphere.
Technically, the biosphere is the sum of all ecosystems, and materially is a closed system: life does not normally go walk-about around the cosmos. However, life is totally dependent on the Sun's energy and light. And the Earth's surface benefits from heat created by nuclear decay of uranium, thorium, and a few other radioactive substances, in its interior.