#24433: Connection reset 'every time' when running inside Docker container
-------------------------------+--------------------
Reporter: zeonglow | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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:
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
MAINTAINER Chris Huang-Leaver <[email protected]>
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/24433>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.e919a3dcbaf7b3b3b508f2e8ad42db96%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.