简体   繁体   中英

How to share dotnet runtime inside kubernetes pod

So the title it pretty self-explanatory. Lets say I have three containerized dotnet apps and I don't wanna have dotnet runtime inside each container and neither do I wanna install dotnet runtime on host machine. How do I share dotnet runtime between the containers in a single pod, then?

Sorry if it's duplicate or stupid question, I'm newbie in both docker and kubernetes.

In short, you don't need to worry about "duplicating" the dotnet runtime inside each container. The issue you are concerned about is a key feature of containerization, but it takes a little research to understand.

Here is a brief overview of how Docker builds and stores images, and how these images are used by containers.

  • Each image is composed of several "layers."
  • Each layer is overlaid atop the previous layer, only containing the differences from the layer before it.
  • At the very top is a thin, writable container layer.

Because each container has its own writable container layer, and all runtime changes are stored in this container layer, multiple containers can share access to the same underlying image and yet have their own data state. Using your example, if several dotnet containers are running on the same Kubernetes node, they will share any identical read-only image layers, but each container will have a separate read/write container layer.

This reference discusses the topic in further detail: https://docs.docker.com/storage/storagedriver/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM