Docker is widely used by developers to distribute their own software in a portable manner. Docker containers are industry-standard and contain all runtimes and libraries needed to run particular software.
Composing a container is also usually a straightforward process, the required docker-compose command is included in every installation of Docker, in any platform, be it Windows, Linux, or macOS.
However, in some cases, developers might run into the dreaded “docker-compose: Command not Found” response when trying to compose a container in a fresh install of Docker.
What Caused the Issue?
While docker-compose is a part of Docker installation, sometimes it was improperly installed and registered to the system.
Thus, when the command is invoked, the system will throw an error message instead. Thankfully, docker-compose can be installed with a few simple commands.
First, you will need to clean up the “incomplete” Docker installation by running this command:
sudo rm /usr/local/bin/docker-compose
And then, afterward, run this command:
sudo pip uninstall docker-compose
The first command removes the “incomplete”
docker-compose binary, and the second command uninstalls it completely from your system. Now, after docker-compose is uninstalled, we can start reinstalling it with your distribution’s package manager system.
In this article, we are trying to reinstall
docker-compose on a Raspbian system, so
apt-get is used. Run this command to install
python-pip and all its dependencies:
sudo apt-get -y install python-pip
During this process,
python-pip package that is installed in your system will be reinstalled.
python-pip itself is a repository of Python-based software, and from there, we can pull the latest version of
docker-compose to install it in our system.
python-pip is installed, run the following command to reinstall
sudo pip install docker-compose
docker-compose through the python Pip repository is a more straightforward process compared to installing it from APT repositories or building it from the source itself.
After running this command,
docker-compose will be installed from Pip repository and you can now start using
docker-compose. Try to see the installed version with the following command:
The command will print the version of
docker-compose that is installed on your system, and will look like this:
docker-compose version 1.16.1, build 6d1ac219
To sum up, problems of
docker-compose can often be solved by removing the traces of “incomplete”
docker-compose binaries and reinstalling them through the pip repository.
Users on systems based on Debian Linux (such as Ubuntu and Mint) can also add Docker’s repository to your
sources.list and install
apt-get, though this practice is not recommended as adding a repository to
sources.list can increase update time.
We are a bunch of people who are still continue to learn Linux servers. Only high passion keeps pushing us to learn everything.