I’m looking for a way to store data in one container and use that as a volume for another container.
Here’s my use case. I have a system composed of about 10 microservices. Each supplies a discreet information cluster for the system, and contains three containers. Two of these containers are going to be the same across many of the services, at least initially.
Each microservice looks like this; * means I want to use the same image across microservices.
mariadb * api * app-unique-stuff
Each database is populated with some configuration tables unique to the microservice, which I want to persist across restarts/scale changes, etc. Data created during the life of the container I don’t care about (planning to use an external Kafka to store it/replicate to data lake). I also don’t want scaling to share the same local volume; that seems like a bottleneck.
What I’d like to do is store those initial configuration tables for mariadb’s data in the app-unique-stuff container image. Then when I change the configuration or schema I update only my app-unique-stuff image, and I can stay on the latest version of mariadb and the api images.
- How can I use app-unique-stuff’s container as a datastore for mariadb?
- Is there a better way? I’m new to docker and microservices generally.