Self-Hosting · Game Servers
Valheim, Terraria, Factorio Servers in Docker
Not every game server is Palworld. Valheim, Terraria and Factorio are the light end of the dedicated-server world — small memory figures, small worlds, and a shared reputation for running happily on whatever home hardware is already switched on. This guide builds all three the same way, as Docker containers with their worlds in folders you can back up: Valheim as the main build, with its crossplay port reality and automatic world backups, then Terraria and Factorio as worked examples of the same pattern at even smaller scale.
Published Nov 24, 2026
Valheim: the main build
Valheim’s dedicated server is the friendliest of the survival games to host: a hard cap of ten players keeps the scale household-sized by design, the world file is compact, and the maintained community image does the unglamorous work — downloading the server, updating it, and taking automatic backups of the world — for you. The image is ghcr.io/community-valheim-tools/valheim-server; the long-standing alternative is lloesche/valheim-server, which follows the same shape if you prefer it.
services:
valheim:
image: ghcr.io/community-valheim-tools/valheim-server
container_name: valheim
cap_add:
- sys_nice
environment:
SERVER_NAME: "Our Valheim World"
SERVER_PASS: "choose-a-password"
WORLD_NAME: "Dedicated"
ports:
- "2456-2458:2456-2458/udp"
volumes:
- ./valheim-config:/config
- ./valheim-data:/opt/valheim
restart: unless-stopped
Three settings do the work. SERVER_NAME is what players look for in the server list, SERVER_PASS is the join password (the server requires one, at least five characters), and WORLD_NAME names the world the server creates or loads. The sys_nice capability is in the image’s own example and lets the server process set its scheduling priority properly.
Ports, and what crossplay changes
Valheim uses UDP ports 2456 and 2457 in normal operation; the Compose above publishes 2456 through 2458 because the third port joins the set when crossplay is enabled. Crossplay is the mode that lets Xbox and Game Pass players join a server alongside Steam players, and it changes more than the port list: the server stops being a direct connection and routes sessions through the PlayFab backend instead, which changes the join flow (players use a join code) and can change how the server feels on a weak connection. For a Steam-only household, leave crossplay off and keep the direct connection. For a mixed household, it is the price of everyone playing together, and it is a launch flag on the server rather than a different server.
Memory, the world, and its backups
Give Valheim 4 GB. The image’s documentation calls 4 GB the minimum and 8 GB the recommended figure for comfort; measured draw on a fresh world sits near 1.4 GB and grows with the world’s age and building. On a household host, 4 GB is the planning figure that holds, with 8 GB as the no-worries upgrade. The world and the image’s automatic backups of it live in the /config volume — the valheim-config folder in the Compose — which means your backup routine is the same story as the rest of this cluster: the folder is the world, copy the folder. The second volume, /opt/valheim, holds the server program itself, kept persistent so updates and restarts do not re-download it.
Updates follow the same low-drama pattern. The image refreshes the server build when it starts, so after a game patch the whole update procedure is: copy the config folder, restart the container, and let it fetch the new build before it loads the world. Worlds are forward-compatible across the game’s patches in practice, but the copy-first habit costs two minutes and makes the question theoretical.
Terraria: the lightest useful server
Terraria’s server is the opposite end of the scale: 1 to 2 GB of memory, a world measured in megabytes, and a server that a NAS will not notice. The maintained image is ghcr.io/beardedio/terraria, which packages the TShock server software — the version with proper player accounts, permissions and world protection that a shared server wants:
services:
terraria:
image: ghcr.io/beardedio/terraria
container_name: terraria
tty: true
stdin_open: true
ports:
- "7777:7777"
volumes:
- ./terraria-data:/config
restart: unless-stopped
Port 7777 is TCP here — one of the few in this cluster. The one behavioral difference from the other examples: the first start is interactive. The server asks, through its console, what world to create or load, so attach to it once (docker compose attach terraria), answer the questions, and from then on it starts unattended like the others. Worlds and configuration live in the mounted /config folder. Modded play through tModLoader raises the memory figure to roughly 2 to 4 GB and is a different server build; the vanilla-and-TShock setup above is the right default for a household world.
Factorio: where the processor is the budget
Factorio’s headless server is the third shape: tiny memory, serious processor appetite at scale. The image is factoriotools/factorio, the port is 34197 over UDP (with 27015 TCP for the optional remote console), and the whole installation — saves, mods, settings — lives in one /factorio volume:
services:
factorio:
image: factoriotools/factorio
container_name: factorio
ports:
- "34197:34197/udp"
- "27015:27015/tcp"
volumes:
- ./factorio-data:/factorio
restart: unless-stopped
Give it 2 GB and stop worrying about memory. What a growing factory actually consumes is processor: the simulation is single-threaded, and a megabase eventually asks more of one core than any core can give, at which point the game slows for everyone equally. That is a late-game concern measured in hundreds of hours; for a household factory, the same fast-core advice from the sizing guide applies, and the server will be an invisible tenant on the host until then.
One pattern, three servers
Read the three Compose files together and the pattern is the cluster’s whole method: one folder per game holding the world, one small port block (mostly UDP), restart: unless-stopped so the servers return after a power cut, and nothing about the host modified. Add the panel question — whether you want a web interface over these — and that is the Crafty Controller guide; add friends from outside the house and that is the anchor guide’s exposure rules. The servers themselves are the easy part, and on hardware terms they are nearly free: the box below runs all three at once without effort.
Prices are editorial estimates, checked against retailer listings on the date stated on the page, and change often — the links open current listings where you can verify price and availability. Some links may earn a commission at no cost to you — see the disclosure page.
Official documentation and references
- community-valheim-tools/valheim-server — the Valheim image’s documentation: ports, crossplay, memory and the /config layout
- factoriotools/factorio-docker — the Factorio image’s documentation and volume layout
- beardedio/terraria — the TShock Terraria image and its first-start world setup
Frequently asked questions
How much RAM does a Valheim server need?
Plan on 4 GB. The image’s documentation sets 4 GB as the minimum and 8 GB as the comfortable figure; a fresh world idles near 1.4 GB and grows as the world ages and fills with buildings. Four gigabytes is the figure that holds for a household server.
What does Valheim crossplay actually change?
It lets Xbox and Game Pass players join alongside Steam players — and it reroutes the server through a session backend, adds port 2458 to the 2456–2457 set, and switches joining to a code-based flow. For a Steam-only household, leaving it off keeps the simpler direct connection.
Why is Terraria’s first start interactive?
Because the server creates its world by asking questions — new or existing world, size, difficulty — through its console. Attach to the container once, answer, and the choices are saved into the mounted config folder; every start after that is unattended.
Can one small host really run all three servers?
Yes. Valheim at 4 GB, Terraria at 1 to 2 GB and Factorio at 2 GB total under 8 GB of allocations, and none of them is processor-hungry at household scale except Factorio in its very late game. A current mini PC or a 16 GB NAS runs the three together with room to spare.
Where are the worlds kept, for backups?
In the mounted folders, by design: Valheim’s world and its automatic backups in the config volume, Terraria’s in its config folder, Factorio’s saves in the /factorio volume. Backing up a server is copying its folder while it is stopped or quiescent — the same discipline as every other guide in this cluster.

