How to fix: Version in "./docker-compose.yml" is unsupported

Updated . Posted . Visible to the public.

When running an older version of docker-compose you might see the following 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/
$ cat ./docker-compose.yml
version: '3.3'
...

You can fix this issue by upgrading docker-compose Show archive.org snapshot to the newest version (just download the new script from the install section). Make sure you uninstall the any previous apt package before coping the script via curl sudo apt remove docker-compose.

Check your docker-compose version

$ docker-compose --version                                                                                                                                                                                
docker-compose version 1.17.1, build unknown

$ docker-compose version
docker-compose version 1.17.1, build unknown
docker-py version: 2.5.1
CPython version: 2.7.17
OpenSSL version: OpenSSL 1.1.1  11 Sep 2018

Notice that the --version output still might references to the old version (maybe some bug in 1.28.2).

$ docker-compose version                                                                                                                                                                               
docker-compose version 1.28.2, build 67630359
docker-py version: 4.4.1
CPython version: 3.7.9
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

$ docker-compose --version                                                                                                                                                                         
docker-compose version 1.17.1, build unknown
Last edit
Emanuel
License
Source code in this card is licensed under the MIT License.
Posted by Emanuel to makandra dev (2021-01-27 14:25)