Docker curl: (56) Recv failure

Hello guys,

I am novice with Docker :frowning:
I have this error :
curl -v localhost:8080
curl: (56) Recv failure

My Dockerfile :

FROM python:latest
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
VOLUME /usr/src/app
CMD [ “python”, “./” ]

docker build -t api .
With my latop 0 problem, with docker curl: (56) Recv failure

Logs my service web Python :
docker run --name api -p 8080:8080 api

  • Serving Flask app “server” (lazy loading)
  • Environment: production
    WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
  • Debug mode: off
    /usr/local/lib/python3.7/site-packages/flask_sqlalchemy/ FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
    'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and ’
  • Running on (Press CTRL+C to quit)

After 1 curl, 0 signal :frowning:

Do you have idea ?


Hi creaprog,
I have a very trivial question.
Are you overwriting the default flask port (5000) within somehow?
If not, I think your issue might be related to the fact that you are mapping the wrong port number.
You should instead try -p 8080:5000
I hope it helps.


thx but, same problem :frowning:

What happens when you try curling from within the container 5000?
If that works. My next worry would be to look for your machine firewall specs.
56 from curl means the connection was reset.
Do you have a running firewall? You might have to allow 8080.

In my container : curl: (7) Failed to connect to port 5000: Connection refused

I don’t have firewall, same error with my Mac. I have try with ubuntu and Mac.

Oh! Within the container? Interesting! This means that your flask server is not running (crashed) or that you are using a flask config that has overwritten the default port 5000 (may be 8080?). In case of a crash, may be try to attach to the running container and investigate that. Then try running the flask server yourself to see the reason of the crash. Otherwise investigate the appropriate internal port your server is running off and that may work for the mapping.

I have the same problem he does :

My serer flask don’t crash because i see the log.

With container off :
curl: (7) Failed to connect to port 8080

With container on :
curl: (56) Recv failure


Before :
if name == “main”:, port=8080)

After :
if name == “main”:, port=8080, host=‘’)

THX :slight_smile:

1 Like

Make sure you run your service as{port} rather than{port}.

Thank You
It’s worked for me :slight_smile: