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?
David FavorConnect With a Mentor Linux/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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.