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
user group, 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 container-registry.oracle.com/mysql/community-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
Container Registry and navigate to the MySQL Router image in
the MySQL repository for a complete list of tags for available
Table 2.1 Variables
||Required. MySQL host to connect to.|
||Required. MySQL server listening port.|
||Required. MySQL user to connect with.|
||Required. String. MySQL user's password.|
||Optional. Integer. Wait for this number of cluster instances to be online.|
||Optional. Boolean. Whether to create a new account for MySQL Router to use when running. Default value is enabled (1). Set to 0 (zero) to disable.|
||Optional. Comma-separated list of additional command line options to apply during bootstrapping.|
Running in a container requires a working InnoDB cluster. If supplied, the run script waits for the given mysql host to start, the InnoDB cluster to have the MYSQL_INNODB_CLUSTER_MEMBERS-defined number of members, and then uses the supplied host for bootstraping. See Section 3.1, “Bootstrapping MySQL Router”.
$> docker run \ -e MYSQL_HOST=localhost \ -e MYSQL_PORT=3306 \ -e MYSQL_USER=mysql \ -e MYSQL_PASSWORD=mysql \ -e MYSQL_INNODB_CLUSTER_MEMBERS=3 \ -e MYSQL_ROUTER_BOOTSTRAP_EXTRA_OPTIONS="--conf-use-socket --conf-use-gr-notification" -ti container-registry.oracle.com/mysql/community-router
To use a specific version of MySQL Router, add a tag to the
-ti value. For example:
for MySQL Router 8.0.33. To use the latest version, do not add a
Checking the status:
$> docker ps
For additional details, see Oracle Container Registry and navigate to the MySQL Router image in the MySQL repository.