running multiple mysql instances on one Docker Host - Ubuntu 17.04

My goal is to install 4+ MySQL instances on one Docker host.  Each SQL Instance is a different version..  Can I assign dedicated IPs to each instance?  I know I can do port translation but I prefer dedicated IPs..
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You can run as many instances of MySQL/MariaDB as you like at a machine/host level + keep in mind...

The shipped systemd files expect only one instance using /var/lib/mysql, so to run multiple instances you'll have to create an entirely custom system or maybe find on on github.

That said, likely a much easier way to do this is how I run 100s of MariaDB instances on one machine.

Use LXD.

Each MySQL/MariaDB instance gets its own container. You can then arrange for your docker instances to connect via normal GRANTs.

Using LXD means there's no code changes or mucking about with multiple datadir settings on one machine (multiple /var/lib/mysql backing stores).

If you do tool your own multiple MySQL instance setup, be sure to completely remove the default systemd scripts + /var/lib/mysql. If you don't do this + accidentally end up with two or more instances starting up which point to /var/lib/mysql, you'll end up with corrupted data.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.