This steps will guide you to install docker-compose inside its own, isolated virtual environment. This way you can install latest docker-compose without mangling your system Python installation.
Installing docker-compose with following steps:
# these steps work with both python and python3
sudo apt install python3-pip python3-dev libffi-dev libssl-dev
sudo pip3 install docker-compose
Is going to overlay python packages installed by apt with dependencies installed along with docker-compose
. This may cause compatibility issues with Python packages installed by apt
, and may lead to some hard to fix issues with entire system.
DO NOT EVER MIX
sudo
ANDpip
UNLESS YOU ARE ABSOLUTELY SURE ABOUT THAT!
Python virtualenv was created precisely for the purpose of dependency isolation.
Installing within virtualenv is recommended in the official docker-compose installation guide.
You can copy docker-compose-install.sh
contents into a file, set exection flag and run as sudo:
chmod u+x docker-compose-install.sh
sudo ./docker-compose-install.sh
Or follow instructions below to do it manually.
sudo apt update
sudo apt install python3-venv python3-dev libffi-dev libssl-dev
sudo mkdir -p /opt/local/docker-compose
sudo python3 -m venv /opt/local/docker-compose/venv
This may take some time becase some dependecies have to be compiled.
sudo /opt/local/docker-compose/venv/bin/pip install --upgrade pip
sudo /opt/local/docker-compose/venv/bin/pip install docker-compose
This is necessary so our new docker-compose is available on the $PATH
, and makes it possible to simply call docker-compose
.
sudo ln -s /opt/local/docker-compose/venv/bin/docker-compose /usr/local/bin/docker-compose
You can invoke this any time, and it will install newest available version of docker-compose.
sudo /opt/local/docker-compose/venv/bin/pip install --upgrade docker-compose
To uninstall simply remove virtualenv directory and the symlink.
sudo rm -rf /usr/local/bin/docker-compose /opt/local/docker-compose
[sudo] /opt/local/docker-compose/venv/bin/pip install --update pip
throws the errorno such option: --update
on a clean 2020-05-27-raspios-buster-lite-armhf installation.