79638916

Date: 2025-05-26 12:41:33
Score: 1
Natty:
Report link

You're facing this error because using an old version of the compose command, docker-compose. A newer version is available i.e., docker compose (notice the missing -)

Here's a step-by-step guide on how to solve this error:

  1. You'll have to remove the old version of docker-compose. Run sudo apt-get remove docker-compose;

  2. In the event where you installed docker-compose using the curl command, you should remove it using: sudo rm /usr/local/bin/docker-compose

  3. Install Docker Compose v2

    1. Update: sudo apt-get update;

    2. Create a directory to store the CLI Plugin: mkdir -p ~/.docker/cli-plugins;

    3. Download the docker compose binary: curl -SL https://github.com/docker/compose/releases/download/v2.36.2/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

    4. Make the binary executable: chmod +x ~/.docker/cli-plugins/docker-compose

    5. Verify your installation: docker compose version

  4. [If using a yml file] Now you can go ahead and run docker compose -f docker/docker-compose.prod.yml build <service_name>

  5. [If not using ayml file] Just cd to the directory where you have the Dockerfile, and use docker compose build

Reasons:
  • Blacklisted phrase (1): how to solve this error
  • Blacklisted phrase (1): how to solve
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: tykoon