Self-hosting

RustDesk Server with Docker

Reviewed November 30, 2026Independent reference, not the official RustDesk siteReport a correction

RustDesk Docker is the container packaging of hbbs and hbbr: you pull rustdesk/rustdesk-server, mount a host directory at /root so the key survives, and start one container per command. Docker Compose with network_mode: "host" is the layout the official Docker page recommends for most Linux servers. RustDesk Server Pro can be started from the publisher’s pro.yml quick start. The image does not remove the need for a firewall, a backup of the data directory, or clients that carry the public key.

The pull, run, and compose blocks on this page match the Docker documentation reviewed for this guide. rasdesc.com is independent of the RustDesk project and does not publish images.

Why operators reach for containers

Docker is for moving hbbs and hbbr off a laptop onto a host that comes back cleanly after a reboot. Containers only package the processes. Clients still register with hbbs, still try UDP and TCP hole punching, and still use hbbr when a direct path fails. The architecture page covers that flow. Here you get start commands and how to keep keys on disk.

The official Docker guide describes three shapes: Compose for most Linux servers, docker run for a quick manual test, and Podman Quadlet where a host already manages containers through systemd. This article stays with the Docker examples. If you run Podman, copy the Quadlet units from the current Docker documentation rather than from memory.

Prerequisites

Install a current Docker engine, and install the Compose plugin if you want the file-based start. You need a directory on durable disk. The documented volume is ./data:/root. Everything hbbs writes under /root in the container, including id_ed25519.pub, appears in ./data on the host. Back that directory up before you upgrade the image. Losing it forces a new key into every client.

You also need the ports for the role you are exposing. Native clients need TCP 21115–21117 and UDP 21116. The Pro web console uses TCP 21114, and it can stay private if HTTPS 443 is the public front. TCP 21118 and 21119 are the web-client WebSocket ports. Keep them closed unless a reverse proxy is the only client, because X-Real-IP and X-Forwarded-For are not validated. Map those rules in the port guide before you publish the host.

Pro needs outbound HTTPS for the license check. The open-source image path has no license check. Either way, the host needs a clock that stays synchronized, because a failed registration is hard to tell apart from a bad key when the time is also wrong.

Supported environment

--net=host is a Linux behavior. It lets hbbs and hbbr see the real incoming address rather than a container bridge address such as 172.17.0.1. The official page says that when host networking works, the -p publish options are not used. Docker Desktop on Windows and macOS does not provide that Linux host-network behavior. The same page tells Windows users to leave out sudo and --net=host, and it says to remove --net=host if you are having connection problems on your platform. Treat that as the rule for Docker Desktop on macOS as well: drop host networking when sessions or registration fail, and follow the current official page for the port publications that replace it.

The image is published for the architectures the project builds. A Raspberry Pi or other ARM board can run it for a small deployment. That is a capacity statement, not a benchmark. Many simultaneous relays are a poor fit for a small board, whatever the container runtime is. TrueNAS is not a special image. It is a place you might run this same Compose file, usually inside a virtual machine, because SCALE’s app networking does not automatically give you Linux host networking.

Manual docker run

Use the manual form when you want to see each process start once, before you commit to a file. From the official Docker page:

sudo docker image pull rustdesk/rustdesk-server
sudo docker run --name hbbs -v ./data:/root -td --net=host --restart unless-stopped rustdesk/rustdesk-server hbbs
sudo docker run --name hbbr -v ./data:/root -td --net=host --restart unless-stopped rustdesk/rustdesk-server hbbr

The first line pulls the image. The next two create containers named hbbs and hbbr, mount the same data directory, run detached, use host networking, and restart unless you stop them. The final argument is the command inside the image: hbbs or hbbr. Both containers share ./data so the relay and the ID service see the same key material the server generated.

-td allocates a pseudo-terminal and detaches. If you cannot see logs that way, the official page says to use docker logs hbbs. You can also run with -it instead of daemon mode while you are diagnosing a start failure. Do not run a second hbbs with the same name. Remove or rename the old container before you retry, or Docker will refuse the name.

Flag in the official exampleRole
--name hbbs / --name hbbrStable container names for logs and restarts.
-v ./data:/rootPersists keys on the host. The public key file is id_ed25519.pub.
-tdDetached start. Read output later with docker logs.
--net=hostLinux host networking. Remove it when Docker Desktop cannot use it.
--restart unless-stoppedBring the container back after a daemon restart until you stop it on purpose.
hbbs / hbbrThe process the container should execute.

Docker Compose

Compose is the repeatable form. The official example uses network_mode: "host", the volume ./data:/root, and the commands hbbs and hbbr:

services:
  hbbs:
    container_name: hbbs
    image: rustdesk/rustdesk-server:latest
    command: hbbs
    volumes:
      - ./data:/root
    network_mode: "host"

    depends_on:
      - hbbr
    restart: unless-stopped

  hbbr:
    container_name: hbbr
    image: rustdesk/rustdesk-server:latest
    command: hbbr
    volumes:
      - ./data:/root
    network_mode: "host"
    restart: unless-stopped

Save that as compose.yml in the directory that should contain data, then start it:

docker compose up -d

depends_on starts hbbr before hbbs. It does not wait for an application-level health check. If the relay container exits immediately, fix that container before you debug client registration. network_mode: "host" is the Compose spelling of --net=host. On Docker Desktop, remove that key from both services when host networking is the thing breaking connections. Do not leave one service on the host network and the other on a bridge unless you are following a current official example that says to do so.

The homepage quick start is a download of a publisher-maintained compose file. For the open-source stack:

wget rustdesk.com/oss.yml -O compose.yml
docker compose up -d

For Pro:

wget rustdesk.com/pro.yml -O compose.yml
docker compose up -d

Open whichever file you downloaded and read it before docker compose up. The publisher’s homepage also offers a quick start that pipes a remote shell script into a shell. Read that script before you run it. Prefer a compose file you have inspected. The rest of the install order, including how clients learn the key, is the setup guide.

Optional relay-only environment

The Docker documentation shows ALWAYS_USE_RELAY=Y when you want hbbs to tell clients to use the relay. That is an optional policy. It is not required for a normal install, and it does not by itself reduce your public ports to TCP 443. A separate documented mode publishes only TCP 443 and forces sessions through a WebSocket relay, with no direct peer-to-peer path. Setting the variable and building that 443-only front are different tasks. The environment example is:

services:
  hbbs:
    container_name: hbbs
    image: rustdesk/rustdesk-server:latest
    environment:
      - ALWAYS_USE_RELAY=Y
    command: hbbs
    volumes:
      - ./data:/root
    network_mode: "host"

    depends_on:
      - hbbr
    restart: unless-stopped

  hbbr:
    container_name: hbbr
    image: rustdesk/rustdesk-server:latest
    command: hbbr
    volumes:
      - ./data:/root
    network_mode: "host"
    restart: unless-stopped

Turn this on only when you accept that relayed sessions consume your server’s bandwidth. Docs say hole punching works in the majority of cases, so the default is to let direct sessions stay direct.

What you should see

After the first start, ./data/id_ed25519.pub exists. That file is what you paste into the client Key field. The ID server field gets the host name clients use to reach this machine. The relay field can stay empty when hbbr is on the same host, because port 21117 is inferred. On Pro, the API server field is the console address, port 21114 or an HTTPS URL. It is a different value from the license key and from id_ed25519.pub.

docker logs hbbs and docker logs hbbr should show the processes staying up rather than exiting in a loop. A client configured with this ID server and this public key should show Ready. “Not ready, please check your connection” means the client never completed registration. A detached container that exited will look the same from the client as a firewall drop, which is why the logs come before a second round of port changes.

Troubleshooting containers

Name conflicts are the first Docker-specific failure. The official examples use the container names hbbs and hbbr. An old test container holding that name blocks the new one. Host networking is the second. If clients cannot register and you are on Docker Desktop for Windows or macOS, remove --net=host or network_mode: "host" and re-read the official page before you invent a port map. A Linux VPS that can use host networking should keep it, because that is how the processes see real client addresses.

An empty ./data directory after a “successful” start usually means the volume did not mount where you think it did. Compose resolves ./data relative to the compose file. A docker run started from another working directory mounts a different folder. Find the directory that actually contains id_ed25519.pub and point clients at that public key only.

If registration works and sessions do not, the relay container is the next log to read. UDP 21116 can be open while TCP 21117 is not, or the reverse. The client status Ready only proves hbbs. It does not prove hbbr. Clock skew, a key copied from a previous data directory, and a DNS name that points at the wrong host all produce the same Not ready text. There is no public status page in this guide that can clear those.

Security notes

The data volume is the crown jewel of the container. Anyone who can read it can copy the private key that matches id_ed25519.pub. Restrict the directory to the operators who already administer the host. Include it in backups. Exclude it from world-readable sync folders and from images you commit to a registry.

Host networking means the container is not hidden behind Docker’s bridge. The firewall on the Linux host is the control. Open the minimum native set, TCP 21115–21117 and UDP 21116. Add 21114 only for a Pro console that is not already on HTTPS. Do not publish 21118 and 21119 on the public interface. If you need the web client, let a reverse proxy be the only connector, and let that proxy set the forwarding headers. Direct exposure lets a caller spoof X-Real-IP or X-Forwarded-For.

Encrypted self-hosted use still depends on clients having the key from this server’s id_ed25519.pub. Container packaging does not change the documented limit: the normal ID-based model is the one described with NaCl end-to-end encryption, and Direct IP access is a separate path the FAQ documents as unencrypted. Leave Direct IP access off. Run this stack only for computers you are allowed to administer. The security notes and the official client downloads are the matching client-side controls.

Frequently Asked Questions

Which image should the compose file use?

The official Compose example uses rustdesk/rustdesk-server:latest for both services. The manual docker image pull line uses rustdesk/rustdesk-server without a tag. Pin a digest in your own change process if you need reproducible upgrades. This guide does not invent a version tag.

Does RustDesk Docker work on Docker Desktop for Mac or Windows?

You can run the image, but --net=host is a Linux behavior. The official Docker page says to remove host networking when it causes connection problems, and it tells Windows users to leave out sudo and --net=host. A Linux host is the environment that matches the published Compose file.

Where does the key go when the container is recreated?

Onto the host path in the volume, ./data in the example, because that path is mounted at /root. Recreating the container keeps the key if the volume stays. Deleting the directory generates a new key on the next hbbs start, and every client must be updated.

What does ALWAYS_USE_RELAY=Y change?

It is the optional environment example in the Docker documentation for forcing relay use. Sessions then depend on hbbr and on your uplink. It is not the same task as publishing only TCP 443 through a WebSocket reverse proxy.