How to get `docker compose` command working in macOS
/ 1 min read
The easiest way to set up docker CLI tooling is to simply install Docker Desktop. It’s free for non-commercial usage and is fairly straightforward to use. If you are like me, however, and prefer to stick to open source tooling rather than being stuck with proprietary packages you cannot control, you are probably using an OSS Docker Desktop replacement like Colima.
For Colima to work as a Docker runtime, you’ll need to install two things using homebrew:
brew install docker- the main docker command itself.brew install docker-compose- the compose command that’s shipped separately.
Newer versions of the official Docker CLI have shipped with docker compose, replacing the legacy docker-compose command. Unfortunately, this is not true for the homebrew packages.
Fortunately, the fix is incredibly simple. Just make the compose command available as a docker plugin (the cliPluginsExtraDirs section below):
{ "auths": {}, "currentContext": "colima", "cliPluginsExtraDirs": [ "/opt/homebrew/lib/docker/cli-plugins" ]}After saving this file, docker compose will magically spring to life. And the docker-compose command will keep working too.
Credit: Shout out to this stackoverflow answer.