The Docker deployment framework supports easy installation and configuration of MySQL Router. This section explains how to use a MySQL Router Docker image.
You need to have Docker installed on your system before you can use a MySQL Router Docker image. See Install Docker for instructions.
You need to either run
docker commands with
sudo, or create a
usergroup, and then add to it any users who want to run
docker commands. See details
Because Docker containers are always run with root privileges,
you should understand the
daemon attack surface and properly mitigate the related
The MySQL Docker images maintained by the MySQL team are built specifically for Linux platforms. Other platforms are not supported, and users using these MySQL Docker images on them are doing so at their own risk.
Downloading the server image in a separate step is not strictly necessary; however, performing this step before you create your Docker container ensures your local image is up to date. To download the MySQL Community Edition image, run this command:
$> docker pull mysql/mysql-router:tag
tag is the label for the image
version you want to pull (for example,
latest label is used, and the
image for the latest GA version of MySQL Community Router is
downloaded. Refer to the list of tags for available versions on
page in the Docker Hub.
Table 2.1 Variables
Running in a container requires a working InnoDB cluster. If supplied the run script waits for the given mysql host to be up, the InnoDB cluster to have MYSQL_INNODB_CLUSTER_MEMBERS members and then uses the given server for its bootstrap mode. See Section 3.1, “Bootstrapping MySQL Router”.
Example to run the image:
$> docker run \ -e MYSQL_HOST=localhost \ -e MYSQL_PORT=3306 \ -e MYSQL_USER=mysql \ -e MYSQL_PASSWORD=mysql \ -e MYSQL_INNODB_CLUSTER_MEMBERS=3 \ -ti mysql/mysql-router
Checking the status:
$> docker ps
For addition details, such as the available environment variables, see Router's Docker Hub.