Timeline
Timeline
2025-03-14
init
This article introduces the complete process of building a self-hosted RustDesk remote desktop server based on Ubuntu and Docker in a local area network environment. It details Docker environment preparation, port settings, and docker-compose deployment, and summarizes the installation of the Windows client, configuration of ID/relay server IP and key, and the final connection method, providing users with a free, high-frame-rate, and high-resolution remote control alternative.
After using ToDesk for a few days without shutting down, I exhausted all my quota by mid-month and was no longer allowed to use it for free. I uninstalled it and switched to RustDesk, using self-host. It’s free, and the frame rate and resolution are much higher than ToDesk’s free version. Below is the setup record.
Basic Environment Setup
I use two Windows (Win10) machines and one Ubuntu (configuration as shown below). Using Ubuntu as the ID/relay server, one Windows connects to the other. Ubuntu needs Docker installed, and both Windows machines need RustDesk installed and configured.
Note: My three machines are on the same local area network.

Install Docker and docker-compose-plugin
Reference:
After installation, you can add the current user to the docker user group
1 | # Add the docker user group, usually already exists, no need to execute |
docker-compose.yaml
Refer to the official documentation:
If ufw is enabled, these ports need to be opened:
1 | sudo ufw status |
Choose a directory to store ID/relay server data:
1 | mkdir -p ~/rustdesk |
Below is the docker-compose.yaml file from the RustDesk official documentation above:
1 | services: |
Then start:
1 | docker compose up -d |
RustDesk installation and configuration
Install by visiting the following link:
After installation, open the network settings, fill in the IP of the ID/relay server (i.e., the IP of the server running Docker) into the ID server and relay server fields. The controlled end may leave the relay server blank, but it is recommended to fill it in for the controlling end. Then, the controlling end fills in the key (the content of the .pub file in the data folder above).

Finally, enter the ID and password of the controlled end to connect.