docker,

Resolve Docker's 'Version in docker-compose.yml is unsupported' error

Apr 20, 2022 · 1 min read · Post a comment
Resolve Docker's 'Version in docker-compose.yml is unsupported' error

Let’s take a look at the not so common Docker Compose error:

"Configuration 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/"

The solution is quite obvious, so let’s dive into it.

Prerequisites

  • Docker
  • Docker Compose

Solution

Step 1. Remove the current Docker Compose version first.

sudo apt-get remove docker-compose

Step 2. Install the latest Docker Compose version, by following the official guide.

Note: Two other things to try if this doesn’t work though.

  1. Upgrade the Docker engine too.
  2. Try to downgrade. Specify an older docker-compose file version. For instance, if you are still getting the same error for version ‘3.8’, try with version number ‘3.7’, and so on ..you get me.

Conclusion

If you can think of any alternative solution, feel free to write a comment below. On a side note, follow our official channel on Telegram.