Using `up`, `down`, `ps`, and `logs` with Docker Compose.
Docker Compose provides a set of commands that mirror the regular `docker` CLI but operate on the entire stack of services defined in your `docker-compose.yml` file at once. The most fundamental command is `docker-compose up`. By default, it runs in the foreground, showing logs from all services. Adding the `-d` flag (`docker-compose up -d`) starts the services in detached mode, running them in the background. To see the status of all services in your stack, you can use `docker-compose ps`. This will show you which containers are running, their state, and the ports they are exposing. To view the aggregated logs from all services, the `docker-compose logs` command is used. You can follow the logs in real-time with the `-f` flag (`docker-compose logs -f`) or view logs for a specific service by adding its name (`docker-compose logs -f web`). When you want to tear down your entire application stack, the `docker-compose down` command is the clean and correct way to do it. It not only stops the containers but also removes them, along with the network that Compose created automatically. If you also want to remove any named volumes defined in the compose file, you can add the `--volumes` flag (`docker-compose down --volumes`). These commands provide a simple yet powerful interface to manage the complete lifecycle of your multi-container application.