# Error: failed to fetch an image or build from source: error building: failed to receive status: rpc

**URL:** <https://community.fly.io/t/error-failed-to-fetch-an-image-or-build-from-source-error-building-failed-to-receive-status-rpc/19091>\
**Category:** Questions / Help\
**Tags:** login-only\
**Created:** [April 3, 2024, 12:50pm UTC](https://community.fly.io/t/error-failed-to-fetch-an-image-or-build-from-source-error-building-failed-to-receive-status-rpc/19091 "2024-04-03T12:50:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nycu3108](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/nycu3108/32/27657_2.png) [@nycu3108](https://community.fly.io/u/nycu3108)\
**Post date:** [April 3, 2024, 12:50pm UTC](https://community.fly.io/t/error-failed-to-fetch-an-image-or-build-from-source-error-building-failed-to-receive-status-rpc/19091/1 "2024-04-03T12:50:04Z")

</div>

Hi there,

I am attempting to deploy a Flask-based machine learning application, and I have followed the instructions in the documentation to execute ‘fly deploy’. However, after multiple attempts, the deployment fails consistently when transferring context, reaching 600~700MB. Below is the error message provided:

> Error: failed to fetch an image or build from source: error building: failed to receive status: rpc error: code = Unavailable desc = error reading from server: read unix @-\>C:\Users\green.fly\fly-agent.sock: wsarecv: An existing connection was forcibly closed by the remote host.ocker/dockerfile:1

Here is my Dockfile and the result of running ‘fly doctor’.

Dockfile:

> # syntax = docker/dockerfile:1
> 
> ARG PYTHON\_VERSION=3.8.19
> 
> FROM python:${PYTHON\_VERSION}-slim
> 
> LABEL fly\_launch\_runtime=“flask”
> 
> WORKDIR /code
> 
> COPY requirements.txt requirements.txt  
> RUN pip3 install -r requirements.txt
> 
> COPY . .
> 
> EXPOSE 8080
> 
> CMD [“python3”, “-m” , “flask”, “run”, “–host=0.0.0.0”, “–port=8080”]

fly doctor:

> Testing authentication token… PASSED  
> Testing flyctl agent… PASSED  
> Testing local Docker instance… Nope  
> Pinging WireGuard gateway (give us a sec)… PASSED  
> Testing WireGuard DNS… PASSED  
> Testing WireGuard Flaps… PASSED
> 
> App specific checks for js-test-cold-shadow-4331:  
> Checking that app has ip addresses allocated… Nope  
> No ip addresses assigned to this app. If the app is not intended to receive traffic, this is fine.  
> Otherwise, it likely means that the services configuration is not correctly setup to receive http, tls, tcp, or udp traffic.  
> [Fly Launch configuration (fly.toml) · Fly Docs](https://fly.io/docs/reference/configuration/#the-services-sections)  
> No public ipv4 or ipv6 ip addresses allocated to app js-test-cold-shadow-4331
> 
> Build checks for js-test-cold-shadow-4331:  
> Checking docker context size (this may take little bit)… PASSED (1.6 GB)  
> Checking for .dockerignore… Nope  
> Found no .dockerignore to limit docker context size. Large docker contexts can slow down builds.  
> Create a .dockerignore file to indicate which files and directories may be ignored when building the docker image for this app.  
> More info at: [Dockerfile reference | Docker Docs](https://docs.docker.com/engine/reference/builder/#dockerignore-file)

Has anyone encountered a similar issue and found a solution? I believe it might be a network-related problem, but I haven’t been able to find a corresponding solution. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [April 11, 2024, 12:58am UTC](https://community.fly.io/t/error-failed-to-fetch-an-image-or-build-from-source-error-building-failed-to-receive-status-rpc/19091/4 "2024-04-11T00:58:21Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
