How to give docker-compose alias to the new docker compose (v2) command?
I noticed that docker-compose 1.x is gently being dropped in favor of the new v2:
https://www.docker.com/blog/announcing-compose-v2-general-availability/
So I then removed my docker-compose
v1.x command (I think it was the way to go, but I cannot find the old documentation on how to install/uninstall docker-compose anymore):
$ sudo rm -rf /usr/local/bin/docker-compose
Then I installed the new version according to the doc:
$ sudo apt-get install docker-compose-plugin
and voilà:
$ docker compose version
Docker Compose version v2.5.0
But all my scripts which used to call docker-compose
(with a dash) are no more working. Obviously.
Hence my question; how could I alias the new compose command to docker-compose
?
Is it sufficient to add this line to by .bashrc
file?
$ echo "alias docker-compose='docker compose'" >> ~/.bashrc
$ source ~/.bashrc