Home > Blockchain >  docker-compose is installed but docker compose is not recognized
docker-compose is installed but docker compose is not recognized

Time:11-16

Running docker compose up gives docker: 'compose' is not a docker command.

But docker-compose up works just fine.

What gives? I thought compose was supposed to be part of the docker cli now.

How can I run docker compose up and get the same/similar behavior as docker-compose up?

docker --version -> Docker version 20.10.10, build b485636f4b

docker-compose --version -> Docker Compose version 2.1.1

CodePudding user response:

Docker (in the cli is docker) and Docker Compose (on the cli is docker-compose) are different things.

Docker is the engine where the containers run

Docker-compose is a manager or orchestrator for those containers

This means that you cannot do docker compose, the correct command is docker-compose

I think you're confused on the commands

the way to start a container using docker (only 1 container) is

docker run -ti ubuntu bash

On the other hand you can do the same with Docker compose but you need a docker-compose.yml file where all the configuration is written, then to start it is

docker-compose up

To sum up

Docker and docker compose are 2 different things. You can find more info here What is the difference between docker and docker-compose

CodePudding user response:

It's because I had docker installed not through docker desktop.

I was using a minikube for my docker daemon, and the basic docker cli. But the basic cli (installed through brew install docker) doesn't have docker compose, that's part of docker desktop.

You can find the rest of that info here:

https://docs.docker.com/compose/cli-command/

  • Related