This guide walks you through running a Rust dedicated server inside a Docker container. You’ll end up with a persistent, easily updatable game server that runs in the background and can be managed with simple Docker commands. Before starting, you need Docker installed on your host machine (Linux is recommended, but Windows with WSL2 works too), a basic understanding of the command line, and enough disk space (the server requires around 10–15 GB after installation).
What You’ll Need
- A machine with Docker installed (version 20.10 or newer).
- At least 4 GB of RAM (8 GB or more is recommended for a smooth experience).
- At least 15 GB of free disk space for the server files and world saves.
- Basic familiarity with terminal/command prompt commands.
- Optional: A Steam account (not required for running the server, but needed if you want to use SteamCMD directly).
Step-by-Step
- Create a directory for the server data. On your host, run:
mkdir rust-serverand thencd rust-server. This folder will hold the server files and configuration. - Create a Dockerfile. Inside the directory, create a file named
Dockerfilewith the following content:FROM ubuntu:22.04 RUN apt-get update && apt-get install -y wget lib32gcc-s1 lib32stdc++6 RUN useradd -m rust USER rust WORKDIR /home/rust RUN wget -O steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz && \ tar -xzf steamcmd.tar.gz && rm steamcmd.tar.gz RUN ./steamcmd.sh +login anonymous +force_install_dir /home/rust/rustserver +app_update 258550 validate +quit EXPOSE 28015/udp 28016/tcp 28017/tcp CMD ["./rustserver/RustDedicated", "-batchmode", "+server.port", "28015", "+server.level", "Procedural Map", "+server.seed", "12345", "+server.worldsize", "3000", "+server.maxplayers", "50", "+server.hostname", "My Docker Rust Server", "+server.description", "Rust server running in Docker", "+server.url", "", "+server.headerimage", "", "+server.identity", "server", "+rcon.port", "28016", "+rcon.password", "changeme", "+rcon.web", "1"]Note: The
app_update 258550installs the dedicated server. TheCMDline starts the server with basic settings. You can adjust these later. - Build the Docker image. Run:
docker build -t rust-server .This will pull the base image, install dependencies, and download the Rust server files. This step may take 10–20 minutes depending on your internet speed. - Run the container. Start the server with:
docker run -d --name rust-dedicated -p 28015:28015/udp -p 28016:28016/tcp -p 28017:28017/tcp -v $(pwd)/rustserver:/home/rust/rustserver rust-server
This maps the ports (UDP for game traffic, TCP for RCON and web) and mounts a volume so your world saves persist even if the container is removed. - Check the server logs. Use
docker logs -f rust-dedicatedto see the startup output. Wait for the message “Server startup complete” or similar before connecting. - Connect to the server. In Rust, open the console (F1) and type
client.connect localhost:28015if testing on the same machine, or use your server’s IP address from another machine. - Manage the server. To stop the server:
docker stop rust-dedicated. To start it again:docker start rust-dedicated. To remove the container (keeping the data):docker rm rust-dedicated.
Common Mistakes
- Forgetting to map ports correctly. The game port (28015) must be UDP, and RCON (28016) must be TCP. If you map the wrong protocol, clients won’t connect.
- Not using a volume. Without a volume, all server data is lost when the container is deleted. Always mount a host directory to
/home/rust/rustserver. - Using the wrong identity name. The
server.identityparameter defines the folder name for saves. If you change it, the server starts fresh. Keep it consistent. - Setting a weak RCON password. The default password in the Dockerfile is ‘changeme’. Change it immediately to something strong, otherwise anyone can control your server.
- Not opening the firewall. Ensure your host firewall allows inbound traffic on ports 28015/udp, 28016/tcp, and 28017/tcp (if using web RCON).
Tips
- Use a named volume instead of a bind mount. For better portability, use
-v rust-data:/home/rust/rustserver. Docker manages the storage location. - Automate updates. Add a cron job on the host to run
docker exec rust-dedicated ./steamcmd.sh +login anonymous +force_install_dir /home/rust/rustserver +app_update 258550 validate +quitweekly. Then restart the container. - Customize server settings via environment variables. Instead of hardcoding in the Dockerfile, you can pass
-e SERVER_SEED=12345and use an entrypoint script to build the command line. This makes it easier to change settings without rebuilding. - Monitor resource usage. Use
docker statsto see CPU and memory consumption. Rust servers are hungry; if the server lags, consider limiting the world size or player count. - Back up your saves. Regularly copy the
serverfolder (inside the rustserver directory) to a safe location. You can also use Docker volumes with a backup container.
Troubleshooting
- Server won’t start. Check the logs with
docker logs rust-dedicated. Common causes: missing lib32gcc-s1 (install it), insufficient disk space, or the SteamCMD download failed. Rebuild the image after fixing the issue. - Clients can’t connect. Verify the port mapping with
docker port rust-dedicated. Ensure your firewall allows UDP 28015. Test locally withclient.connect localhost:28015first. - Server crashes during world generation. This often happens when the container runs out of memory. Increase the RAM limit with
--memory=8gin thedocker runcommand, or reduce the world size. - RCON not working. Make sure you set
+rcon.web 1and that port 28016 is TCP. If using a tool like RustAdmin, check the password and IP. Try connecting withtelnet yourserver 28016to see if the port is open. - Server updates fail. Run the SteamCMD update command manually inside the container:
docker exec -it rust-dedicated ./steamcmd.sh +login anonymous +force_install_dir /home/rust/rustserver +app_update 258550 validate +quit. Look for errors like “No connection” – that usually means Steam is down. - World resets after restart. This happens if the
server.identityparameter changes or the volume isn’t mounted correctly. Double-check yourdocker runcommand includes-v.
Frequently Asked Questions
Do I need to own Rust to run a server?
No. The dedicated server files are free and can be downloaded via SteamCMD without a Steam account. However, you do need a legitimate copy of the game to connect and play.
Can I run the server on Windows with Docker Desktop?
Yes, but you must use Linux containers (the default). The Dockerfile uses Ubuntu, so it works fine. Just ensure your Windows version supports WSL2 and that you’ve enabled virtualization.
How do I change the map seed or world size after the server is running?
Edit the CMD line in the Dockerfile and rebuild the image, or modify the server.cfg file inside the server folder if you have one. Then restart the container. Note that changing the seed or world size will generate a new world.
How can I make the server appear in the community server list?
Ensure your server is publicly accessible (ports open) and that you set a valid server.url and server.headerimage (optional). The server should auto-register with Steam’s server list after a few minutes.
Is it safe to use the default RCON password?
No. Change it immediately. Use a strong password (at least 12 characters, mix of letters and numbers). Anyone with RCON access can execute commands on your server, including banning players or wiping the world.
How do I update the server to the latest version?
Run the SteamCMD update command inside the container (as shown in Troubleshooting) and then restart the container. To automate this, set up a cron job on the host that runs the update command and then docker restart rust-dedicated.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- HP 9730e: Wide Prints, Not A3 Scans
- What 8888 Does When You Use It as DNS Server
- Credential Manager: Seamless Sign-In Explained
- API Governance for Public Data: What Growing Portfolios Need
- Samsung Smart Speaker Rollable Display: Facts
- Enterprise AI Hidden Cost: Data Architecture ROI