Software Dev
Software Dev

Reputation: 1102

Ubuntu docker-compose wrong Compose file version

I'm using docker-compose in an Ubuntu 20.04 VM. My docker-compose version is docker-compose version 1.25.0, build unknown. When I try building, I get this error:

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/

How do I upgrade to the latest version of docker-compose on Ubuntu to fix this?

The file looks like this:

version: "3.8"
services:
    ...
networks:
    ...

Upvotes: 4

Views: 9715

Answers (1)

BMitch
BMitch

Reputation: 263469

If you're not using features from "3.8", the easiest is to downgrade the version number in your "docker-compose.yml". For the 1.25.0 release, that looks like no greater than "3.7" or "2.4".

To upgrade your compose install, the readme on the git repo has various options for installing docker-compose. My preference, until the docker compose command is bundled in the Linux install, is to use pip install docker-compose.

Upvotes: 6

Related Questions