I have an app called A that uses MongoDB for state. My plan is to use Docker and perhaps create one container for the app and one for MongoDB and then link A with MongoDB (possibly using fig). From what I understand I ought to use a data volume or "data-only containers" for MongoDB state. But if I understand it correctly you link to an image (MongoDB image in this case). Does this mean that I need to restart MongoDB when I deploy a new version of A?
What I want to do is to deploy changes to A (A') without loosing MongoDB state and (possibly) without taking MongoDB down. Without Docker I would just bring A down and deploy A' and have it connect to the same MongoDB instance (that would still be running). This is especially important if I run multiple instances of A behind a load balancer. How would I achieve this in a good way using the Docker infrastructure? Is linking only a good option if I run a single instance of A?