Dolan Antenucci
Dolan Antenucci

Reputation: 15942

Docker Compose run that takes user input crashes with "broken pipe"

I'm using Docker for a Django environment, but when I run a command like docker-compose run web bash, whatever I type after bash loads up never shows, and then eventually the process dies with the following error:

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

Here's my 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

Here's my 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/

I'm running Docker 1.8.1, Compose 1.4.0, Machine 0.4.1, Python 2.7.10, all on OS X 10.10.5. I tried removing all docker containers and rebuilding my project, but I get the same error. I also tried rebuilding my docker-machine and starting everything from scratch, but same problem again.

Note: there are two changes I can think of that may be related to this not working:

  1. OS X 10.10.5 upgraded me from Python 2.7.6 to 2.7.10.
  2. I found this Github issue where someone mentioned getting this "broken pipe" error after fixing "InsecurePlatformWarning" warning. I also applied a fix to address this (pip install requests[security]) in the last few days, but things were working directly after applying this change, but maybe the combo of it and python 2.7.10 are a problem?

Any ideas on why this crashes?

Upvotes: 0

Views: 2844

Answers (1)

Dolan Antenucci
Dolan Antenucci

Reputation: 15942

As described by michaelperret on a docker-compose github issue, he started getting the same issue when he applied the fix for the InsecurePlatformWarning. I had applied this fix myself a few days ago, but it looks like the "broken pipe" issue didn't surface until I did a restart of my system (OS X upgraded me to 10.10.5).

The fix was me uninstalling some packages that were part of the fix:

pip uninstall pyopenssl ndg-httpsclient pyasn1

Upvotes: 2

Related Questions