问题
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
- download cassandra.tar from cassandra website
- 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