Repository: mlflow/mlflow

Issue:
Can not connect to remote machine in local network
### System information
- **OS Platform and Distribution `Linux Ubuntu 16.04.5`**:
- **MLflow installed from `binary`**: 
- **MLflow version `1.0.0`**:
- **Python version `3.6.6`**: 
- **Exact command to reproduce**:
`mlflow server --host 0.0.0.0`
`mlflow server --host <local_ip_addr>`

### Describe the problem
I am trying to connect remote machine on my local network. But it seems the  `mlflow server` did not listens all network interfaces. I tried to start server with local ip address of machine but it did not work. I am sure I can access to the machine because I have different services running on it. The problem maybe caused by gunicorn.



Discussion:
*bump*

related: `mlflow ui` does not allow the user to specify an IP to bind to (like `jupyter` does) but instead hard-codes 127.0.0.1: https://github.com/mlflow/mlflow/blob/69fabbcf59b690f021bf047c0bf3e2de594c70e6/mlflow/cli.py#L198

also, it's confusing to have two entrypoints to the UI?  are we supposed to use `mlflow ui` or `mlflow server`?  

I was able to get `mlflow server --host $MY_IP` to work the same way as `jupyter` does.  But `mlflow ui` binds to an IP that doesn't work.

FWIW I am running `mlflow` in a docker container on a remote machine.  Also Tensorboard always binds to a useable IP (or maybe it just listens on all interfaces).  Not sure why Tensorboard does the right thing while `mlflow` and `jupyter` need configuration.

I would propose fixing / deprecating the `mlflow ui` entrypoint.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

*bump*
Thank you for interacting with this issue! Removing the stale label!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Perhaps we should create a new issue that allows the server to listen to arbitrary IP address? Similar to jupyter, flask, etc.
Thank you for interacting with this issue! Removing the stale label!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

*bomp*
Thank you for interacting with this issue! Removing the stale label!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

*bamp*
Thank you for interacting with this issue! Removing the stale label!


Resolving patch:
diff --git a/mlflow/cli.py b/mlflow/cli.py
--- a/mlflow/cli.py
+++ b/mlflow/cli.py
@@ -163,14 +163,17 @@ def _validate_server_args(gunicorn_opts=None, workers=None, waitress_opts=None):
               help="Path to local directory to store artifacts, for new experiments. "
                    "Note that this flag does not impact already-created experiments. "
                    "Default: " + DEFAULT_LOCAL_FILE_AND_ARTIFACT_PATH)
-@click.option("--port", "-p", default=5000,
-              help="The port to listen on (default: 5000).")
-def ui(backend_store_uri, default_artifact_root, port):
+@cli_args.PORT
+@cli_args.HOST
+def ui(backend_store_uri, default_artifact_root, port, host):
     """
     Launch the MLflow tracking UI for local viewing of run results. To launch a production
     server, use the "mlflow server" command instead.
 
-    The UI will be visible at ``http://localhost:5000`` by default.
+    The UI will be visible at http://localhost:5000 by default, and only accept connections
+    from the local machine. To let the UI server accept connections from other machines, you will
+    need to pass ``--host 0.0.0.0`` to listen on all network interfaces (or a specific interface
+    address).
     """
 
     # Ensure that both backend_store_uri and default_artifact_uri are set correctly.
@@ -192,7 +195,7 @@ def ui(backend_store_uri, default_artifact_root, port):
 
     # TODO: We eventually want to disable the write path in this version of the server.
     try:
-        _run_server(backend_store_uri, default_artifact_root, "127.0.0.1", port, None, 1)
+        _run_server(backend_store_uri, default_artifact_root, host, port, None, 1)
     except ShellCommandException:
         eprint("Running the mlflow server failed. Please see the logs above for details.")
         sys.exit(1)


Test patch: