You've installed docker and docker-compose independently.
Compose is a Docker plugin. For Docker to find the plugin, it needs to know its location.
There are many ways to install docker-compose as a plugin, they are all documented in the docker Install the compose plugin documentation page. And yes, this is done automatically for you when you use Docker Desktop.
I prefer to install them separately and run the following commands to show docker where docker-compose is located. That also solves the problem. The following should work on most linux distros:
# Create your local docker config CLI plugins folder, if it doesn't exist
mkdir -p "$HOME"/.docker/cli-plugins
# Create a symlink to docker-compose in that folder
ln -s "$(which docker-compose)" "$docker_compose_plugin_file"
If you are using Homebrew on macOS, you can use the fix above or you can use the recommended solution indicated by running brew info docker-compose and looking at the caveat information.
==> Caveats
Compose is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
"cliPluginsExtraDirs": [
"/opt/homebrew/lib/docker/cli-plugins"
]
docker-composeinstead ofdocker compose.