Repository: localstack/localstack

Issue:
bug: localstack config validate: `Errno 2 no such file or directory: 'docker-compose'`
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

- following the [installation steps](https://docs.localstack.cloud/getting-started/installation/) fails when validating localstack configuration

- error
![image](https://github.com/localstack/localstack/assets/10324554/d82ef62e-c8b8-402e-8195-e691733cfeb1)

- localstack is indeed running
![image](https://github.com/localstack/localstack/assets/10324554/44d7180a-5090-416d-afa9-c4eaaedca33e)


### Expected Behavior

- localstack can consume the path I pass `--file`

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker compose up -d
    localstack config validate --file ./compose.yaml


### Environment

```markdown
OS: Ubuntu 20.04
    LocalStack: latest
```


### Anything else?

- you can reproduce [on this branch](https://github.com/noahehall/localstack/tree/rds) if it still exists
  - else switch to the develop branch


Discussion:
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our [Slack Community](https://localstack.cloud/contact/) for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our [contributing guidelines](https://github.com/localstack/.github/blob/main/CONTRIBUTING.md) and our [contributing guide](https://docs.localstack.cloud/contributing/).
Hi @noahehall !
You are right. Currently, the CLI uses `docker-compose` to validate the config. On some systems with newer docker compose versions (>2), there is no alias from `docker-compose` to `docker compose`, which leads to this error.

We will fix this in the next version of the `localstack` CLI.

Resolving patch:
diff --git a/localstack/utils/bootstrap.py b/localstack/utils/bootstrap.py
--- a/localstack/utils/bootstrap.py
+++ b/localstack/utils/bootstrap.py
@@ -25,7 +25,7 @@
 from localstack.utils.docker_utils import DOCKER_CLIENT
 from localstack.utils.files import cache_dir, mkdir
 from localstack.utils.functions import call_safe
-from localstack.utils.run import run, to_str
+from localstack.utils.run import is_command_available, run, to_str
 from localstack.utils.serving import Server
 from localstack.utils.sync import poll_condition
 from localstack.utils.tail import FileListener
@@ -267,8 +267,15 @@ def validate_localstack_config(name: str):
     compose_file_name = name if os.path.isabs(name) else os.path.join(dirname, name)
     warns = []
 
+    # some systems do not have "docker-compose" aliased to "docker compose", and older systems do not have
+    # "docker compose" at all. By preferring the old way and falling back on the new, we should get docker compose in
+    # any way, if installed
+    if is_command_available("docker-compose"):
+        compose_command = ["docker-compose"]
+    else:
+        compose_command = ["docker", "compose"]
     # validating docker-compose file
-    cmd = ["docker-compose", "-f", compose_file_name, "config"]
+    cmd = [*compose_command, "-f", compose_file_name, "config"]
     try:
         run(cmd, shell=False, print_error=False)
     except CalledProcessError as e:


Test patch: