EDIT (2023 sept) : for recent docker installation, docker-compose come now as docker plugin : docker-compose-plugin and we call it by docker compose
without -
have a look at official doc : https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
OLD SOLUTION (with ubuntu repository) :
Docker-compose takes place only in a binary file, so it is easy to put the last version !
First, if you have a previous installed version, remove it, in my case, I had version from main repository, so I ran :
sudo apt remove docker-compose
then go to https://github.com/docker/compose/releases and download, for example, for 2.2.3 : https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64
or other one
then move this file to :
sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
and
sudo chmod +x /usr/local/bin/docker-compose
check d-c runs correctly :
docker-compose --version
that returns in my case :
Docker Compose version v2.2.3
Under ubuntu 18.04, official docker are today at v19.03.13 and it is ok to work with compose v2
See also :