|
| 1 | +.. _rm-install-docker: |
| 2 | + |
| 3 | +=================== |
| 4 | +Install with Docker |
| 5 | +=================== |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 1 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +You can install and run Relational Migrator as a Docker container. |
| 14 | +Running Relational Migrator with Docker ensures an installation process |
| 15 | +that is both independent of the operating system and straightforward |
| 16 | +to replicate. |
| 17 | + |
| 18 | +About this Task |
| 19 | +--------------- |
| 20 | + |
| 21 | +You can also use `Docker Compose <https://docs.docker.com/compose/>`__ |
| 22 | +to run Relational Migrator. You can find a Docker Compose example file |
| 23 | +in the |
| 24 | +`download center <https://www.mongodb.com/try/download/relational-migrator>`__. |
| 25 | +If you use Docker Compose, you must set environment variables |
| 26 | +for ``MIGRATOR_PATH_DATA`` to the local path for the data volume mount |
| 27 | +and ``MIGRATOR_PATH_DRIVER`` to the path of the JAR file with the |
| 28 | +JDBC drivers. |
| 29 | + |
| 30 | +Before you Begin |
| 31 | +---------------- |
| 32 | + |
| 33 | +Install `Docker <https://docs.docker.com/install/>`__ |
| 34 | + |
| 35 | +Procedure |
| 36 | +--------- |
| 37 | + |
| 38 | +.. procedure:: |
| 39 | + :style: normal |
| 40 | + |
| 41 | + .. step:: Pull the MongoDB Docker Image |
| 42 | + |
| 43 | + .. code-block:: sh |
| 44 | + |
| 45 | + docker pull public.ecr.aws/v4d7k6c9/relational-migrator:latest |
| 46 | + |
| 47 | + .. step:: Run the Image as a Container |
| 48 | + |
| 49 | + The tabs below show various docker commands that are useful for |
| 50 | + running Relational Migrator: |
| 51 | + |
| 52 | + .. tabs:: |
| 53 | + |
| 54 | + .. tab:: Basic |
| 55 | + :tabid: basic-run |
| 56 | + |
| 57 | + The ``-p 8080:8080`` in this command maps the container port to the host port. |
| 58 | + This allows you to connect to Relational Migrator by browsing to |
| 59 | + `<http://localhost:8080>`__: |
| 60 | + |
| 61 | + .. code-block:: sh |
| 62 | + |
| 63 | + docker run --name mongodb-relational-migrator -p 8080:8080 public.ecr.aws/v4d7k6c9/relational-migrator:latest |
| 64 | + |
| 65 | + .. tab:: Persist Data Directory |
| 66 | + :tabid: logging-directory |
| 67 | + |
| 68 | + The following command makes the project files and logs |
| 69 | + persistent even if the container is stopped: |
| 70 | + |
| 71 | + .. code-block:: sh |
| 72 | + |
| 73 | + docker run --name mongodb-relational-migrator -p 8080:8080 -v c:\temp\migdocker\data:/root/Migrator public.ecr.aws/v4d7k6c9/relational-migrator:latest |
| 74 | + |
| 75 | + .. tab:: Map a Jar File |
| 76 | + :tabid: map-jar |
| 77 | + |
| 78 | + The following command maps a single jar file that contains a |
| 79 | + JDBC driver to the container. This is useful for Oracle and |
| 80 | + MySQL migration projects because those drivers are not included |
| 81 | + with Relational Migrator by default: |
| 82 | + |
| 83 | + .. code-block:: sh |
| 84 | + |
| 85 | + docker run --name mongodb-relational-migrator -p 8080:8080 -v C:\Temp\migdocker\drivers\ojdbc11.jar:/opt/mongodb-relational-migrator/lib/app/lib/driver.jar public.ecr.aws/v4d7k6c9/relational-migrator:latest |
| 86 | + |
| 87 | + .. note:: Override a Config Setting |
| 88 | + |
| 89 | + You can specify a configuration setting to override in the |
| 90 | + Docker command. For example, consider disabling telemetry with |
| 91 | + the following command: |
| 92 | + |
| 93 | + .. code-block:: bash |
| 94 | + |
| 95 | + docker run --name mongodb-relational-migrator -p 8080:8080 -e MIGRATOR_APP_TELEMETRY_ENABLE=false public.ecr.aws/v4d7k6c9/relational-migrator:latest |
| 96 | + |
| 97 | + .. step:: Check that the Container is Running |
| 98 | + |
| 99 | + To check the status of your Docker container, run the following |
| 100 | + command: |
| 101 | + |
| 102 | + .. code-block:: sh |
| 103 | + |
| 104 | + docker container ls |
| 105 | + |
| 106 | + The output from the ``ls`` command lists the following fields that |
| 107 | + describe the running container: |
| 108 | + |
| 109 | + - ``Container ID`` |
| 110 | + - ``Image`` |
| 111 | + - ``Command`` |
| 112 | + - ``Created`` |
| 113 | + - ``Status`` |
| 114 | + - ``Port`` |
| 115 | + - ``Names`` |
| 116 | + |
| 117 | + .. code-block:: sh |
| 118 | + :copyable: false |
| 119 | + |
| 120 | + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 121 | + 82b1f8adca43 public.ecr.aws/v4d7k6c9/relational-migrator:latest "/opt/mongodb-relati…" 46 seconds ago Up 44 seconds 0.0.0.0:8080->8080/tcp pedantic_kirch |
| 122 | + |
| 123 | + .. step:: Open the application |
| 124 | + |
| 125 | + To view the application, navigate to: `<http://localhost:8080>`__. |
| 126 | + |
| 127 | + .. note:: |
| 128 | + |
| 129 | + If you changed the port number in the ``docker run`` command, |
| 130 | + you also need to change the port in the url above. |
| 131 | + |
| 132 | +Next Steps |
| 133 | +---------- |
| 134 | + |
| 135 | +- :ref:`rm-connection-strings` |
| 136 | +- :ref:`rm-create-project-live` |
| 137 | +- :ref:`rm-mapping-rules` |
| 138 | + |
| 139 | +Learn More |
| 140 | +---------- |
| 141 | + |
| 142 | +- :ref:`rm-projects` |
| 143 | +- :ref:`rm-manage-relational-model` |
0 commit comments