Not enough space to unpack image

I cannot deploy my app because my image is apparently too large (it is 6.8GB compressed):

2024-09-28T21:03:32.843 runner[48e5939b304408] bos [info] Pulling container image registry.fly.io/knooki:deployment-01J8X7416P3DK4RYPAZ8SPSSQN

2024-09-28T21:05:36.529 runner[48e5939b304408] bos [error] Not enough space to unpack image, possibly exceeds maximum of 8GB uncompressed

How should I go around this problem?

Deploy a smaller image for your app. Maybe you don’t need all that data and can slim down the image a bit, or if you really need it all, you can load the rest onto a larger volume as part of your run command.

Excuse my ignorance, but how could I inspect the image that was built to see what’s in there. Where can I find it?

You could build the image locally with docker. E.g. with docker build -t knooki . (in the folder where your Dockerfile is. Then there multiple ways too look into it. The most simply way might be with Docker Desktop.

Your Dockerfile might contain a bunch of dev bloat.

My Docker images are so large because of the indirect CUDA dependencies in PyTorch and some other indirectly included libraries. Although they are not used if a machine has no GPU, they are still there and hard to get rid of.

Which libraries/dependencies are those?

torch, torchvision, onnxruntime

According to perplexity:

  • PyTorch: ~2GB (average for GPU)
  • Torchvision: ~300MB
  • ONNX Runtime: ~300MB

Adding these together gives us:

  • Total = 2GB + 0.3GB + 0.3GB = 2.6GB

You probably have some other models baked in? I don’t think there’s a way around this limitation other than loading your models at runtime.

Here are all my direct dependencies. There is nothing sizable extra really.

requirements.txt:

absl-py
aiohttp
fastapi
gin-config
inflect
loguru
pathvalidate
pipecat-ai[azure,cartesia,daily,deepgram,google,openai,silero,together]
python-dotenv
regex
uvicorn

My docker file is 2.65GB. But when I try to deploy the same config to Fly, it ends up being >6GB.

Strange… :person_shrugging:
I have an OLLAMA 3.1:8B, which is roughly 4.7GB and didn’t have any issues deploying that…

It is strange. Just to summarize:

  • In the Docker app I see that my docker image is 2.65 GB.
  • fly deploy states it’s size as 6.8 GB:
    image: registry.fly.io/<redacted>:deployment-01J910GZZ5R4JMHYA68EC65P0X
    image size: 6.8 GB
    
  • Finally, fly logs shows the following log:
    2024-09-30T08:25:15.190 runner[148e240df75798] ewr [info] Pulling container 
    image registry.fly.io/<redacted>:deployment-01J910GZZ5R4JMHYA68EC65P0X
    
    2024-09-30T08:28:39.849 runner[148e240df75798] ewr [error] Not enough 
    space to unpack image, possibly exceeds maximum of 8GB uncompressed
    

I have no idea why docker builds a 2.65GB image, while fly builds a 6.8 GB image. Something seems a bit off, at the very minimum the reporting that would allow me to debug the issue.

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