Search code examples
dockerdocker-composedockerfile

Why is Docker installed but not Docker Compose?


I have installed docker on CentOS 7 by running following commands,

curl -sSL https://get.docker.com/ | sh
systemctl enable docker && systemctl start docker
docker run hello-world

NOTE: helloworld runs correctly and no issues.

however when I try to run docker-compose (docker-compose.yml exists and valid) it gives me the error on CentOS only (Windows version works fine for the docker-compose file)

/usr/local/bin/docker-compose: line 1: {error:Not Found}: command not found

Solution

  • You also need to install Docker Compose. See the manual. Here are the commands you need to execute

    sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)"  -o /usr/local/bin/docker-compose
    sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
    sudo chmod +x /usr/bin/docker-compose
    

    Note: Make sure that the link pointing to the GitHub release is not outdated!. Check out the latest releases on GitHub.