Using a container in multiple stacks

I have a question on using a container in multiple stacks/services with Rancher. For example, say I have a MySQL server I want to host with Rancher. Is it possible to use that MySQL server in my mail stack as well as my Wordpress stack? I’d like to avoid having to spawn a new MySQL container for each and every service, but still be able to leverage Rancher’s service/stack system to neatly bundle up my containers.

So really, my question is whether or not this is possible, and if it is, how?

Yes, you can link to/use services in other stacks.

How should I got about doing this? Do I just deploy a standalone container with the db and then add a link for the stack?

You’d deploy a service with scale of 1 and then you can use the links for other services in other stacks.

The key part you need is external_links. This is from one of our services which uses a eureka service which is part of the infrastructure stack. That sounds like very much what you’re proposing

external_links:

  • ‘infrastructure/eureka:’