I have a container with pytorch. The container is 3GB. When i run 20 instances of this container it takes 60GB of disk space. I basically have 20 copies of the same library. Is it possible not to have separate copies of the filesystem of the container. If the container fs is set to readonly would that help? Im running in k8s.
Asked
Active
Viewed 92 times
1
-
If you have multiple containers running the same large image, I'd expect all of the copies of the container to share the same physical image on disk. Why do you think this is taking up more space? Is there any application source code involved here, or is this purely a matter of cluster administration? – David Maze Dec 30 '22 at 12:47
1 Answers
1
Is it possible not to have separate copies of the filesystem of the
container.
Yes, you can do that.
You can have the ReadOnlyMany
file system or ReadWriteMany
file system.
Hostpath
You can also leverage the Hostpath to save the files over there and when POD is scheduled on that node it will use from there.
Make sure if your node goes down you might lose the saved file on that node, instead using above solution would be good.
EFS or NFS
If you are on GCP or AWS you can use the existing FS solution to mount the existing file system to multiple POD.
You can also create your own NFS file system and save files into it, when POD gets scheduled it will start using files from NFS shared file system.

Harsh Manvar
- 27,020
- 6
- 48
- 102
-
I'm not sure this quite what I wanted. In my case the docker images are large because of pytorch and some nvidia packages. Basically I want as long as I run 20 containers with the same version for them to share the pytorch and nvidia files. When I deploy a new version and start replacing older containers with the new version, I might have a new version of pytorch so I want my new containers to use the new version the old one to use the old version. If I just mount a filesystem into k8s that is ReadOnlyMany I would have to manage myself this update process... – Nikola Borisov Jan 03 '23 at 23:26
-
yes you right in that case you might have to mange the version in directory so PODs get mounted to that specific directly have the old version of files. – Harsh Manvar Jan 18 '23 at 12:50