The main difference between a community and an ecosystem is that the ecosystem is defined as the result of what happens when a community of living organisms shares and interacts within their environment. What this means is that the ecosystem is a product of a specific community. There are several types of ecosystems, for example, a marine ecosystem, the rain forest ecosystem, the swamp ecosystem, and the desert ecosystem, just to name a few.
A community in itself is a group of beings that share something in common and work, interact, and live together. What happens with the community is that the definition of it does not extend to the specifics of which types of ecosystems can come out of the myriad of communities that exist.
Therefore, a community is a formed group of beings with common locality and with a capacity to come together under a common denominator to establish as specific mode of existence, namely, an ecosystem.