Mount directory to Docker container

This document will teach you how to mount the data directory or your customized configuration file to the Docker container when you launch MatrixOne by using Docker.

Mount the data directory

To ensure the safety of the data directory, mount the local data directory to the Docker container by the following steps:

  1. To check if MatrixOne has been running in Docker, execute the following command:

    1. docker ps -a
  2. To stop the running container if MatrixOne has been running in Docker, execute the following command:

    1. docker stop <containerID>
    2. docker rm <containerID>

    Skip this step if MatrixOne is not running in Docker.

  3. Mount the local empty directory to the Docker container directory /mo-data, execute the following command:

    1. sudo docker run --name <name> --privileged -d -p 6001:6001 -v ${local_data_path}/mo-data:/mo-data:rw matrixorigin/matrixone:0.8.0
    ParametersDescription
    ${local_data_path}/mo-data:/mo-datamount the local disk directory ${local_data_path}/mo-data to the container directory /mo-data
    Tips: The local data directory to be mounted must be an empty directory.

Mount the customized configuration file

If you need to modify the configuration file. In that case, it would be best to copy the configuration file in Docker to your local directory and then mount the local directory where the configuration file is stored to the Docker container directory. Refer to the following steps to mount the configuration file to the Docker container:

  1. To check if MatrixOne has been running in Docker, execute the following command:

    1. docker ps -a
  2. To launch MatrixOne MatrixOne has not been running in Docker, execute the following command:

    1. docker run -d -p 6001:6001 --name matrixone matrixorigin/matrixone:0.8.0
  3. Check the containerID that MatrixOne has been running in Docker, and copy the configuration file directory to the local directory:

    1. docker ps -a
    2. docker cp <containerID>:/etc .
  4. To stop the MatrixOne when the copy is completed, execute the following command:

    1. docker stop <containerID>
    2. docker rm <containerID>
  5. (Optional) Modify the configuration file and save it.

  6. Mount the configuration file to the Docker container directory and launch MatrixOne. Execute the following command:

    1. sudo docker run --name <name> --privileged -d -p 6001:6001 -v ${local_config_path}/etc:/etc:rw --entrypoint "/mo-service" matrixorigin/matrixone:0.8.0 -launch /etc/quickstart/launch.toml
    ParametersDescription
    ${local_config_path}/etc:/etcmount the local customize configration directory ${local_config_path}/etc to the container directory /etc
    —entrypoint “/mo-service”Specifies that the container starts the MatrixOne service
    -launch /etc/quickstart/launch.tomllaunch mode in /etc/

For more information on the description of Docker run, run the commands docker run --help.