Reputation: 4414
From my understanding, docker compose
is the latest version. This is the one at least I installed from docker official documentation.
I am working on a project that use docker-compose
in their makefile.
How could I forward all the calls (and their arguments) from docker-compose
to docker compose
?
I created an alias:
alias docker-compose="docker compose"
It works fine in terminal. But not in the make file.
Upvotes: 58
Views: 49474
Reputation: 339
If you wish to avoid any additional scripts, I recommend you to :
create your alias (in your ~/.profile
| ~/.bash
|zshrc
file)
alias docker-compose="docker compose --compatibility $@"
source your ~/.profile
|.zsh
|bashrc
file in your makefile.
Upvotes: 1
Reputation: 136
Created this gist based on the answer to make it easier:
sudo touch /usr/bin/docker-compose
echo 'docker compose --compatibility "$@"' | sudo tee /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
https://gist.github.com/tatosjb/c477a5c09c4ad8fa67265032831ac94f
Upvotes: 12
Reputation: 401
You can symlink to the docker compose plugin binary. Mine is located at /usr/libexec/docker/cli-plugins/docker-compose. So just:
ln -f -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
Upvotes: 13
Reputation: 4414
One solution I've come up with is to create a little script.
File: /bin/docker-compose
Content:
docker compose "$@"
Alternatively, in order to respect previous container naming convention (with underscore delimiter _
over -
):
docker compose --compatibility "$@"
To make the script executable: sudo chmod +x /bin/docker-compose
.
You can check it with docker-compose version
.
Upvotes: 138