Whatever the OS distrib and the way to install docker-compose, the program is always consisted
in 1 and 1 only binary file : docker-compose
.
So the general idea is to download that and to store it at a location in the PATH of the shell.
Classic Linux OS (Debian, Ubuntu, RedHat)
Currently, we should avoid apt get
because it doesn’t allow to specify exact
versions.
A better way is downloading the binary from the tags git repo.
For example to download the 1.25.1 version :
curl -L "https://github.com/docker/compose/releases/download/1.25.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
And then we set the binary as executable :
chmod a+x /usr/local/bin/docker-compose |
Note : uname
is not mandatory. That makes only the command portable on multiple
linux OS.
For example with a Ubuntu 64 bits, the uname resolution would be : Linux-x86_64
.
Alpine Linux
The download way from the tags of the docker-compose git repo doesn’t work for Alpine.
Since
the file is not compatible with Alpine, Alpine will consider it as an unreadable/non existing
executable file.
A workaround is installing it with py-pip (python package manager).
Here is the procedure (dependencies are required by docker-compose) :
apk add py-pip apk add python-dev libffi-dev openssl-dev gcc libc-dev make pip install docker-compose==version-to-use |
Docker Alpine Linux
Exactly as the previous way.
Commands completion
deprecated way(old docker compose version):
This way doesn’t work for the docker compose plugin version.
Place the completion script in /etc/bash_completion.d/
:
sudo curl -L
https://raw.githubusercontent.com/docker/compose/1.25.3/contrib/completion/bash/docker-compose
-o /etc/bash_completion.d/docker-compose
1.25.3 is here the version. To replace with our current docker-compose version.
Docker compose plugin version:
Currently it is not working but a fix was implemented and merged on the official public repository
, now we have to wait that version be released.
https://github.com/docker/cli/pull/3429