Docker 使用 "broken pipe" 接受用户输入的 Compose 运行 崩溃
Docker Compose run that takes user input crashes with "broken pipe"
我在 Django 环境中使用 Docker,但是当我 运行 像 docker-compose run web bash
这样的命令时,无论我在 bash 加载后键入什么都不会显示,然后最终该进程因以下错误而终止:
Traceback (most recent call last):
File "/usr/local/Cellar/fig/1.3.3/libexec/bin/docker-compose", line 9, in <module>
load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')()
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main
command.sys_dispatch()
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
self.dispatch(sys.argv[1:], None)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch
super(Command, self).dispatch(*args, **kwargs)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch
self.perform_command(*self.parse(argv, global_options))
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command
handler(project, command_options)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 358, in run
dockerpty.start(project.client, container.id, interactive=not options['-T'])
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/__init__.py", line 27, in start
PseudoTerminal(client, container, interactive=interactive, stdout=stdout, stderr=stderr, stdin=stdin).start()
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/pty.py", line 153, in start
self._hijack_tty(pumps)
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/pty.py", line 241, in _hijack_tty
write_stream.do_write()
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/io.py", line 164, in do_write
raise e
OSError: [Errno 32] Broken pipe
这是我的 docker-compose.yml:
web:
build: .
ports:
- "80:80"
links:
- postgres
volumes:
- .:/code
env_file: .env
command: /code/manage.py runserver 0.0.0.0:80
postgres:
image: postgres:latest
这是我的 Docker 文件:
## python, node and bower ##
FROM python:3.4.3
WORKDIR /usr/local
RUN apt-get install curl && \
curl --silent --location https://deb.nodesource.com/setup_0.12 | bash - && \
apt-get install -y nodejs && \
npm install -g bower
ENV PATH /node_modules:$PATH
## code install ##
RUN mkdir /code
WORKDIR /code
ADD ./requirements/ /code/requirements/
RUN pip install -r /code/requirements/docker.txt
ADD ./ /code/
我正在 运行ning Docker 1.8.1,Compose 1.4.0,Machine 0.4.1,Python 2.7.10,都在 OS X 10.10.5。我尝试删除所有 docker 容器并重建我的项目,但我得到了同样的错误。我也尝试重建我的 docker-机器并从头开始一切,但同样的问题再次出现。
注意:我能想到的两个变化可能与此无效有关:
- OS X 10.10.5 将我从 Python 2.7.6 升级到 2.7.10。
- 我发现这个 Github issue 有人提到在修复 "InsecurePlatformWarning" 警告后出现这个 "broken pipe" 错误。在过去的几天里,我还应用了一个修复程序来解决这个问题 (
pip install requests[security]
),但是应用此更改后一切正常,但也许它和 python 2.7.10 的组合有问题?
关于崩溃的原因有什么想法吗?
正如 michaelperret 在 docker-compose github issue, he started getting the same issue when he applied the fix for the InsecurePlatformWarning 上所描述的那样。几天前我自己应用了此修复程序,但看起来 "broken pipe" 问题直到我重新启动系统(OS X 将我升级到 10.10.5)后才出现。
修复是我卸载了修复中的一些软件包:
pip uninstall pyopenssl ndg-httpsclient pyasn1
我在 Django 环境中使用 Docker,但是当我 运行 像 docker-compose run web bash
这样的命令时,无论我在 bash 加载后键入什么都不会显示,然后最终该进程因以下错误而终止:
Traceback (most recent call last):
File "/usr/local/Cellar/fig/1.3.3/libexec/bin/docker-compose", line 9, in <module>
load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')()
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main
command.sys_dispatch()
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
self.dispatch(sys.argv[1:], None)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch
super(Command, self).dispatch(*args, **kwargs)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch
self.perform_command(*self.parse(argv, global_options))
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command
handler(project, command_options)
File "/usr/local/Cellar/fig/1.3.3/libexec/lib/python2.7/site-packages/compose/cli/main.py", line 358, in run
dockerpty.start(project.client, container.id, interactive=not options['-T'])
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/__init__.py", line 27, in start
PseudoTerminal(client, container, interactive=interactive, stdout=stdout, stderr=stderr, stdin=stdin).start()
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/pty.py", line 153, in start
self._hijack_tty(pumps)
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/pty.py", line 241, in _hijack_tty
write_stream.do_write()
File "/usr/local/Cellar/fig/1.3.3/libexec/vendor/lib/python2.7/site-packages/dockerpty/io.py", line 164, in do_write
raise e
OSError: [Errno 32] Broken pipe
这是我的 docker-compose.yml:
web:
build: .
ports:
- "80:80"
links:
- postgres
volumes:
- .:/code
env_file: .env
command: /code/manage.py runserver 0.0.0.0:80
postgres:
image: postgres:latest
这是我的 Docker 文件:
## python, node and bower ##
FROM python:3.4.3
WORKDIR /usr/local
RUN apt-get install curl && \
curl --silent --location https://deb.nodesource.com/setup_0.12 | bash - && \
apt-get install -y nodejs && \
npm install -g bower
ENV PATH /node_modules:$PATH
## code install ##
RUN mkdir /code
WORKDIR /code
ADD ./requirements/ /code/requirements/
RUN pip install -r /code/requirements/docker.txt
ADD ./ /code/
我正在 运行ning Docker 1.8.1,Compose 1.4.0,Machine 0.4.1,Python 2.7.10,都在 OS X 10.10.5。我尝试删除所有 docker 容器并重建我的项目,但我得到了同样的错误。我也尝试重建我的 docker-机器并从头开始一切,但同样的问题再次出现。
注意:我能想到的两个变化可能与此无效有关:
- OS X 10.10.5 将我从 Python 2.7.6 升级到 2.7.10。
- 我发现这个 Github issue 有人提到在修复 "InsecurePlatformWarning" 警告后出现这个 "broken pipe" 错误。在过去的几天里,我还应用了一个修复程序来解决这个问题 (
pip install requests[security]
),但是应用此更改后一切正常,但也许它和 python 2.7.10 的组合有问题?
关于崩溃的原因有什么想法吗?
正如 michaelperret 在 docker-compose github issue, he started getting the same issue when he applied the fix for the InsecurePlatformWarning 上所描述的那样。几天前我自己应用了此修复程序,但看起来 "broken pipe" 问题直到我重新启动系统(OS X 将我升级到 10.10.5)后才出现。
修复是我卸载了修复中的一些软件包:
pip uninstall pyopenssl ndg-httpsclient pyasn1