Docker撰写运行,用户input崩溃与“破pipe”

我使用的是一个Django环境的Docker,但是当我运行一个像docker-compose run web bash这样的命令docker-compose run web bash ,无论我在bash加载后input什么内容,都不会显示出来,然后程序最终会死于下面的错误:

 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 

这是我的Dockerfile:

 ## 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/ 

我在OS X 10.10.5上运行Docker 1.8.1,Compose 1.4.0,Machine 0.4.1,Python 2.7.10。 我试图删除所有docker集装箱和重build我的项目,但我得到同样的错误。 我也尝试重build我的docker机器,并从头开始一切,但同样的问题再次。

注意:有两个我能想到的更改可能与此不起作用有关:

  1. OS X 10.10.5将我从Python 2.7.6升级到了2.7.10。
  2. 我发现这个Github的问题 ,有人提到修复“InsecurePlatformWarning”警告后得到这个“破pipe”错误。 我也在最近几天应用了一个修复来解决这个问题( pip install requests[security] ),但是在应用这个改变之后,事情就直接起作用了,但是它和python 2.7.10的组合是一个问题?

任何想法,为什么这崩溃?

正如在docker -compose github上的michaelperret所描述的那样,当他应用InsecurePlatformWarning的修复时,他开始得到相同的问题。 我前几天自己就应用了这个修补程序,但是看起来“破损的pipe道”问题在我重新启动系统(OS X将我升级到10.10.5)之前并未出现。

解决方法是我卸载一些包是修复程序的一部分:

 pip uninstall pyopenssl ndg-httpsclient pyasn1