How to install docker-compose on Windows
Update 7th of november 2018:
On desktop systems like Docker for Mac and Windows, Docker Compose is included as part of those desktop installs.
Accordingly to the documentation, Docker for Windows and Docker Toolbox already include Compose along with other Docker apps, so most Windows users do not need to install Compose separately.
Update 2017: this is now officially managed (for Windows 10 supporting Hyper-V) with "Docker for Windows".
See "Install Docker for Windows".
It does have a chocolatey installation package for Docker, so:
choco install docker-for-windows # orchoco upgrade docker-for-windows
Again, this requires a 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later) and Microsoft Hyper-V.
For other Windows, you still need VirtualBox + Boot2Docker.
Update: docker compose 1.5 (Nov 2015) should make it officially available for Windows (since RC2).
Pull requests like PR 2230 and PR 2143 helped.
Commit 13d5efc details the official Build process for the Windows binary.
Original answer (Q1-Q3 2015).
Warning: the original answer ("docker-compose
in a container") below seems to have a bug, according to Ed Morley (edmorley
).
There appear to be caching issues with the "docker-compose in a container" method (See issue #6: "Changes to docker-compose.yml and Dockerfile not being detected")
As such for now, running the Python
docker-compose
package insideboot2docker
seems to be the most reliable solution for Windows users (having spent many hours trying to battle with the alternatives).To install docker-compose from PyPI, run this from inside
boot2docker
:
docker@boot2docker:~$ tce-load -wi python && curl https://bootstrap.pypa.io/get-pip.py | \ sudo python - && sudo pip install -U docker-compose
To save having to run the above every time the
boot2docker
VM is restarted (since changes don't persist), you can usebootlocal.sh
like so:
docker@boot2docker:~$ echo 'su docker -c "tce-load -wi python" && \ curl https://bootstrap.pypa.io/get-pip.py | \ python - && pip install -U docker-compose' | \ sudo tee /var/lib/boot2docker/bootlocal.sh > /dev/null && \ sudo chmod +x /var/lib/boot2docker/bootlocal.sh
(The
su docker -c
gymnastics are required sincetce-load
cannot be run asroot
, andbootlocal.sh
is run asroot
. Thechmod
ofbootlocal.sh
should be unnecessary once #915 is fixed.
Add-a
to thetee
command if you need to append, rather than overwritebootlocal.sh
.)If you wish to use a pre-release version of docker-compose, then replace
pip install -U docker-compose
withpip install -U docker-compose>=1.3.0rc1
or equivalent.
Original answer:
I also run docker-compose
(on Windows boot2docker) in a image by:
- cloning https://github.com/docker/compose in
/c/Users/<username>/myproject/compose
(in order to have persistence, since/c/Users/<username>
is automatically mounted, when I use VirtualBox with its extension pack ) building the docker-compose image:
cd /c/Users/<username>/myproject/compose# that will put the repo in a detached HEAD, but it does not matter heregit checkout 1.2.0docker build -t docker-compose .
adding a '
dc
' alias (in aprofile
file that I copy to my/home/docker/.ashrc
before launching the boot2docker ssh session.)dc='docker run --rm -i -t -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:`pwd` -w `pwd` docker-compose'
From there, a 'dc up
' or 'dc ps
' just works. On Windows. With boot2docker 1.6.
There is one more solution of running docker-compose under Windows using Babun (a famous port of Cygwin shell with all kinds of enhancements, including a package manager).
Here is how:
1.) Install Babun2.) Open it and instal required dependencies for Python and Pip:
pact install python-setuptools pact install libxml2-devel libxslt-devel libyaml-develcurl -skS https://bootstrap.pypa.io/get-pip.py | pythonpip install virtualenvcurl -skS https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python
3.) Finally run
pip install -U docker-compose
The solution is not mine, taken from here: http://habrahabr.ru/post/260329/
I have a strong opinion, that docker-compose must be installed on a host, not a boot2docker VM, so you don't need to ssh all the time.
You can install docker-compose on Windows with pip:
pip install -U docker-compose