creating different runtime versions of containers from same image

人走茶凉 提交于 2020-06-29 03:32:55

问题


Can I create different runtime versions (containers w.r.t. different configurations) from same image? Eg. in Cassandra, a distributed database, each node in the ring (cluster) of Cassandra needs to know information about other nodes during bootstrap (eg. the seed address). This information is picked from cassandra.yaml file. How can I change this cassandra.yaml file for each container when the container starts?

For example, I suppose the steps to make an image could be

  1. download cassandra.tar from cassandra website
  2. do docker import and make an image of the downloaded cassandra.tar.

If I now run this image, each will have the same cassandra.yaml. This doesn't work for me. I want to change IP addresses in each cassandra.yaml before the container starts. To make matters more complicated, I don't know the IP addresses beforehand because I will run the image in google cloud preferably using Kubernetes. Another challenge I see is that the configuration values in Cassandra are not picked from environment variables but are are read from cassandra.yaml by a java application (at least that is what I have read).

There are some images available which already do that but I don't want to use them. I want to reinvent the wheel so that I can understand the concept.

How can I go about creating my own image of a distributed application in which each runtime can pick its own configuration.

来源:https://stackoverflow.com/questions/62622156/creating-different-runtime-versions-of-containers-from-same-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!