Hi Moustafa Kotb,
The error you are facing is common with large images. Usually Azure Container Instances (ACI) have a limited amount of temporary disk storage. This storage is used to pull and unpack container images before the container starts. The error message "There is not enough space on the disk" means that the image's layers, which are uncompressed during the pull process, are larger than the available ephemeral disk space on the underlying ACI host.
This is why the issue seems intermittent. ACI allocates containers on different hosts, some of which may have slightly more space available than others. However, with a large image, it's likely that you encounter this preventing deployments and scaling.
Kindly follow the steps below to mitigate the issue:
1.In general, reducing the container image size is the best option where you can use smaller base images (e.g., alpine instead of ubuntu).
2.Apply multi-stage builds to copy only what’s needed into the final image and remove build tools, cache, or unnecessary dependencies can help you save some space.
As you have mentioned, reducing the image size isn't a viable option at this time, we can consider other options to handle large images effectively:
1.Mount an Azure Files Share. This is a workaround if you need more disk space for your application's operations. You can mount a large, persistent file share to your container instance. This provides a separate file system that isn't limited by the ACI host's ephemeral storage, allowing your application to pull, unpack, and process large files.
2.Use a Different Azure Service. ACI’s ephemeral disk size is fixed and cannot be directly increased. If your workload requires consistently large images, consider Azure Kubernetes Service (AKS) or Azure Container Apps, where nodes/instances have larger OS disks available.
· Azure Kubernetes Service (AKS): AKS gives you full control over the underlying virtual machines (nodes), allowing you to configure them with larger OS disk sizes to accommodate big images.
· Azure Container Apps: This is also a good option. It's built on Kubernetes but is fully managed, and its dedicated workload profiles can support significantly larger container images than ACI's consumption plan.
Firstly, try reducing the image size as much as possible. You can try mounting an Azure Files share if your primary requirement is more runtime disk space. If you need to deploy large images consistently, consider migration to a service like AKS or Container Apps will give you more flexibility and stability when for your workload.
For more information, refer here: Mount an Azure Files share in Azure Container Instances
Troubleshoot common issues - Azure Container Instances | Microsoft Learn
Kindly check the above steps and references provided to troubleshoot your issue. Let me know if you require any additional assistance from my end. I am happy to help you with the queries. If the information is helpful, please click on Upvote and Accept Answer on it so that it can help other community members.
Thanks,
Rashmika