Urgent! :( My Docker Compose file has stopped working!

I deleted the linux instance and recreated a new instance on the cloud.
I have reinstalled docker and docker compose but when I run the following command I get an error.

docker-compose up -d --build

ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

Why does this happen?
On another instance I have the same version of docker and docker compose and everything works fine.

docker version

Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:57 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:03 2022
  OS/Arch:          linux/amd64
  Experimental:     false
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
  Version:          0.19.0
  GitCommit:        de40ad0

docker compose version

Docker Compose version v2.6.0

See you soon and thanks


version: "3.9"


It looks like you are using two different commands. docker-compose could be an older version while docker compose runs the compose plugin of Docker. That version don’t even need the version keyword in the compose file. If you just run

docker compose up -d --build

with the space character between docker and compose, that should work.


Awesome! Problem solved!

Amazing. I’m not sure what drew me to this post, but I had no idea there was a docker compose plugin…

I cannot mark the answer above as a solution, the icon does not appear.

You opened the topic in the discussions category. I moved it to “Open Source Projects » Compose”, now the Solution icon will appear

1 Like

Now I understand the reason thanks. I’m a bummer.