如何在Windows上安装docker-compose [英] How to install docker-compose on Windows

查看:298
本文介绍了如何在Windows上安装docker-compose的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在boot2docker中键入以下命令,如docker网站所示:

  curl -L https:// github .com / docker / compose / releases / download / 1.1.0 / docker-compose-`uname -s` -`uname -m`> / usr / local / bin / docker-compose 
chmod + x / usr / local / bin / docker-compose

当我输入以下命令来检查安装是否成功时,我得到:

  / usr /本地/ bin / docker-compose:行1:语法错误:意外的换行

那么,在boot2docker上安装docker-compose?

解决方案

更新2017:现在正式管理(适用于支持Hyper-V的Windows 10) Docker for Windows

请参见安装Docker for Windows

它有一个巧克力安装 Docker的包,所以:

  choco install docker-for-windows 
#或
choco upgrade docker-for-windows

再次,这需要一个64位的Windows 10 Pro,企业和教育(11月15日更新,Build 10586或更高版本)和Microsoft Hyper-V。



对于其他Windows,您仍然需要VirtualBox + Boot2Docker。






更新:码头工作组合1.5 ( 2015年11月)应该使它正式可用于Windows(自RC2)。



拉请求像 PR 2230 PR 2143 帮助。

提交13d5efc 详细介绍官方Build proc






原始答案(2015年第Q1季Q3)。



警告:根据 docker-compose 在容器中) //github.com/edmorleyrel =nofollow noreferrer> Ed Morley( edmorley


docker-compose in a container方法似乎存在缓存问题(请参阅问题#6:对docker-compose.yml和Dockerfile的更改未被检测到


Ed建议


现在,在<$ c中运行Python docker-compose $ c> boot2docker 似乎是W最可靠的解决方案(/)>

要从PyPI安装docker-compose,请从 boot2docker




  docker @ boot2docker:〜$ 
tce-load -wi python&&卷曲https://bootstrap.pypa.io/get-pip.py | \
sudo python - &&& sudo pip install -U docker-compose




要保存运行每次 boot2docker VM重新启动(由于更改不会持续),您可以使用 bootlocal.sh 所以:




  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




su docker -c 需要体操,因为 tce-load 不能作为 root bootlocal.sh root 运行。 chmod bootlocal.sh 应该不必要一次#915 被修复。

-a 添加到 tee 命令,如果你需要追加,而不是覆盖 bootlocal.sh 。)



如果您希望使用docker-compose的预发行版本,请使用 pip install替换 pip install -U docker-compose -U docker-compose> = 1.3.0rc1 或等同物。







原始答案:



我还运行图片中的 docker-compose (在Windows boot2docker上):





从那里,一个' dc up '或' dc ps '只是工作。在Windows上使用boot2docker 1.6。


If I type the following commands in boot2docker as shown on the docker website:

curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

When I type the following commands to check if the installation was successful, I get:

/usr/local/bin/docker-compose: line 1: syntax error: unexpected newline

So, how can I install docker-compose on boot2docker ?

解决方案

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 
# or
choco 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")

Ed recommends:

As such for now, running the Python docker-compose package inside boot2docker 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 use bootlocal.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 since tce-load cannot be run as root, and bootlocal.sh is run as root. The chmod of bootlocal.sh should be unnecessary once #915 is fixed.
Add -a to the tee command if you need to append, rather than overwrite bootlocal.sh.)

If you wish to use a pre-release version of docker-compose, then replace pip install -U docker-compose with pip install -U docker-compose>=1.3.0rc1 or equivalent.


Original answer:

I also run docker-compose (on Windows boot2docker) in a image by:

From there, a 'dc up' or 'dc ps' just works. On Windows. With boot2docker 1.6.

这篇关于如何在Windows上安装docker-compose的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆