﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24433	Connection reset 'every time' when running inside Docker container	zeonglow	nobody	"This seems somewhat similar to #19022,  but I get the issue with every request,  not just randomly.  So I think that ticket should have been 'cannot reproduce' rather than closed,  hopefully this ticket will be more helpful.

As I discovered this whilst trying to run my Django app inside a Docker component, it should be easy for you to replicate.   I can see this error with just the empty ' you haven't done any work yet' Django app, so we can rule out any problem with my application.

From my host machine:
{{{#!bash
django-admin startproject hellohello
cd hellohello \
&&  ./manage.py migrate && ./manage.py
}}}

Django server starts up,  I can see the welcome screen and all is well.

Using the following Dockerfile

{{{#!bash
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y python3-pip
RUN pip3 install Django==1.7.5
RUN python3 -m compileall /usr/lib/python3*
RUN ln -s /usr/bin/python3 /usr/bin/python
}}}

Build it:
{{{#!bash
sudo docker build -t my-django-python3 .
}}}

Run an interactive terminal from it.  ( the bug is also present if you run the server directly, its just easier to see what is going on this way )
{{{#!bash
sudo docker run -t -i -p 9000:8000 --rm my-django-python3 /bin/bash
}}}

In the container,  to prove that Docker networking is setup correctly;
{{{#!bash
mkdir whatever;  cd whatever
echo 'Hello !' > index.html
python -m http.server
}}}

From the host;   
{{{#!bash
curl http://localhost:9000/
}}}
which should return 'Hello!' as expected

return to the container,  stop the python web server.
Repeat the,   'startproject,  migrate,  runserver'  steps from the beginning of this ticket, only this time in the container.

From the host; 
{{{
curl http://localhost:9000/
}}}
'Connection reset by peer'

There is no mention of the connection attempt in the Django server output,  which stops normally when you ctrl+C it

I have tried this with a number of different configurations;  using python 2 instead of 3,  using the 'official'  Django Docker images (which start with Debian not Ubuntu),  Python images etc.  the same result.

My host machine is also Ubuntu 14:04

#19022 Mentions high load as a possible cause,  in my case,  its just me hitting the server once with Curl.

This post on Stackoverflow http://stackoverflow.com/questions/1434451/what-does-connection-reset-by-peer-mean may be helpful.




"	Bug	new	HTTP handling	1.7	Normal				Unreviewed	0	0	0	0	0	0
