# MT4 REST API - Docker Deployment Guide This guide explains how to run the MT4 RESTful API using Docker from a private registry, including the required ApiKey configuration, if you don't specify UserKey serive work in trial mode with 14 days limit. ## Docker Run Command ```bash docker run -d \ --restart always \ -p 5014:80 \ --name mt4rest \ -e UserKey=abc123xyz \ reg.mtapi.io:5050/root/mt4rest-trial/mt4rest ``` This command runs the mt4 REST container in detached mode, ensures it restarts automatically on failure or system reboot, maps host port 5015 to container port 80, assigns the container name mt4rest, sets the required ApiKey environment variable, and pulls the image from the private registry at reg.mtapi.io:5050. ## Explanation of Parameters - `-d`: Runs the container in detached mode (in the background). - `--restart always`: Ensures the container restarts on failure or system reboot. - `-p 5014:80`: Maps port 80 in the container to port 5015 on the host. - `--name mt4rest`: Assigns the name mt4rest to the container. - `-e ApiKey=abc123xyz`: Sets the required API key as an environment variable inside the container. If not specifeid - works in trial mode. - `reg.mtapi.io:5050/root/mt4rest-trial/mt4rest`: Docker image path from your private registry. ## Accessing the API Once the container is running, the API is accessible at: http://localhost:5014/ To hide API endpoints from unauthenticated users, you can enforce API key protection. To do this, add the ApiKey environment variable when running the container: ```bash -e ApiKey=my-secret-key ``` Then, any request must include the following header: ``` ApiKey: my-secret-key ``` ## Health Check Example To verify that the API is running and healthy: ```bash curl http://localhost:5014/healthz ``` If everything is working correctly, you will receive a 200 OK response. ## Notes - Ensure Docker is installed and the Docker daemon is running. - Confirm that port 5014 is open and not used by another service. - You may change the external port by modifying -p 5014:80 to another value, such as -p 8080:80. - Logs can be viewed using: ```bash docker logs -f mt4rest ```