Replicating MySQL databases in Docker Containers


 

In my prior article, “Running a relational database with Docker”, I showed how to spin up a Docker container with an instance of MySQL running in it. I also showed how you can persist data even when you blow away the container and recreate it by connecting to a Volume or Bind Mount.

In this article I am going to extend this to show you how to use Replication with MySQL instances in Docker Containers.

Replication Basics

For a relational database like MySQL, you can achieve high availability even when using it inside of Docker containers. While this is mostly