I was wondering if there is a limit to the number (not size!) of docker volumes one can attach to a container. The subject is hard to Google since, understandably, most people focus on disk size and not the number.
1 Answer
Docker itself does not impose any limits.
From the postDisk size of a docker image:
There is no limits on the number of volumes a container can have. It is recommended to map directories inside the container that will grow in size into volumes.
However, some cloud providers impose limits upon this number.
From the articleNode-specific Volume Limits:
1Cloud providers like Google, Amazon, and Microsoft typically have a limit on how many volumes can be attached to a Node. It is important for Kubernetes to respect those limits. Otherwise, Pods scheduled on a Node could get stuck waiting for volumes to attach.
The Kubernetes scheduler has default limits on the number of volumes that can be attached to a Node:
Cloud service Maximum volumes per Node Amazon Elastic Block Store (EBS) 39 Google Persistent Disk 16 Microsoft Azure Disk Storage 16