If you installed Docker Desktop/Toolbox for either Windows or Mac, you already have Docker Compose! Play-with-Docker instances already have Docker Compose installed as well. If you are on a Linux machine, you will need to install Docker Compose.
The key difference between docker run versus docker-compose is that docker run is entirely command line based, while docker-compose reads configuration data from a YAML file. The second major difference is that docker run can only start one container at a time, while docker-compose will configure and run multiple.
Difference between docker-compose and Dockerfile. The key difference between the Dockerfile and docker-compose is that the Dockerfile describes how to build Docker images, while docker-compose is used to run Docker containers.
You also need to install Docker Compose. See the manual. Here are the commands you need to execute
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
I'm installing on a Raspberry Pi 3, with Raspbian 8. The curl method failed for me (got a line 1: Not: command not found
error upon asking for docker-compose --version
) and the solution of @sunapi386 seemed a little out-dated, so I tried this which worked:
First clean things up from previous efforts:
sudo rm /usr/local/bin/docker-compose
sudo pip uninstall docker-compose
Then follow this guidance re docker-compose on Rpi:
sudo apt-get -y install python-pip
sudo pip install docker-compose
For me (on 1 Nov 2017) this results in the following response to docker-compose --version
:
docker-compose version 1.16.1, build 6d1ac219
If you installed docker by adding their official repository to your repository list, like:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Just do:
$ sudo apt-get install docker-compose
In case on RHEL based distro / Fedora:
$ sudo dnf install docker-compose
I'm on debian, I found something quite natural to do :
apt-get install docker-compose
and it did the job (not tested on centos)
I'm installing on a Raspberry Pi 3, on Raspbian OS. The curl
method didn't resolve to a valid response. It also said {error: Not Found}
, I took a look at the URL https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-armv7l
and it was not valid. I guess there was no build there.
This guide https://github.com/hypriot/arm-compose worked for me.
sudo apt-get update
sudo apt-get install -y apt-transport-https
echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/hypriot.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 37BBEE3F7AD95B3F
sudo apt-get update
sudo apt-get install docker-compose
first of all please check if docker-compose is installed,
$ docker-compose -v
If it is not installed, please refer to the installation guide https://docs.docker.com/compose/install/ If installed give executable permission to the binary.
$ chmod +x /usr/local/bin/docker-compose
check if this works.
just use brew:
brew install docker-compose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With