How to Use Docker to Host Game Servers on a Home Server (September 2026)

I have been self-hosting game servers from my garage rack for the better part of six years, and the single biggest improvement came when I switched from raw installations to a Docker game server setup. Once I wrapped each game in its own container, my weekend maintenance went from hours to minutes. If you have a spare PC, an old NAS, or a dedicated mini PC, learning how to use Docker to host game servers on a home server is the cleanest way to run Minecraft, Valheim, Counter-Strike, and dozens of other titles for you and your friends.

This guide walks through the entire process from hardware sizing to running your first container. I will include copy-paste docker-compose.yml files for four popular games, share my real-world port forwarding checklist, and answer the questions I see most often in the r/selfhosted and r/docker communities.

Table of Contents

Why Use Docker to Host Game Servers on a Home Server

Yes, Docker can absolutely host a server. In fact, Docker is one of the best tools available for running self-hosted game server workloads on a single machine. A Docker game server packages the game binary, its runtime libraries, and configuration into a single container image, and that container runs the same way on Ubuntu, Windows, or inside a NAS.

How Docker Solves the Game Server Headache

Before containers, every game I installed on my home server competed for the same libraries. Java updates broke Minecraft. SteamCMD updates broke Valheim. A simple Wine dependency clash took down three servers at once. Docker fixes all of that because each container ships with exactly what it needs.

The four biggest wins I see from running a Docker game server setup are:

  • Isolation: One game crashing or being rebooted does not touch the others.

  • Reproducibility: A working docker-compose.yml runs identically on any hardware.

  • Easy updates: Pull a new image, restart the container, and you are done.

  • Lower overhead than VMs: Containers share the host kernel, so you keep almost all your CPU and RAM for the game itself.

Docker vs Virtual Machine for Game Hosting

A virtual machine gives you a full guest OS, which costs you hundreds of megabytes of RAM and a chunk of CPU just to exist. A container shares the host kernel, which means more resources reach the actual game loop. For most home server game hosting scenarios in 2026, containers are the right choice.

I do still keep Proxmox on a second box for Windows-only games that need a hypervisor with GPU passthrough. But for every Linux-native game on my rack, the Docker game server approach wins.

Home Server Hardware Requirements for Docker Game Servers

Hardware sizing matters more than people expect. A Minecraft server for 4 friends runs comfortably on a refurbished thin client. A 40-player Valheim world with heavy base building will punish the same hardware. Before you install anything, match your hardware to the games you actually plan to host.

CPU, RAM, and Storage Sizing

As a baseline I use for the home lab:

  • Minecraft vanilla, 5 players: 2 cores, 4 GB RAM, 20 GB SSD.

  • Minecraft modded, 10 players: 4 cores, 8 GB RAM, 40 GB SSD.

  • Valheim, 8 players: 4 cores, 8 GB RAM, 15 GB SSD.

  • Counter-Strike 2, 10 players: 2 cores, 4 GB RAM, 30 GB SSD.

  • Terraria, 16 players: 2 cores, 4 GB RAM, 10 GB SSD.

For storage, prefer SSD or NVMe over spinning disks. Game worlds rewrite small files constantly, and a slow disk will cause rubber-banding even on a fast connection.

Can a NAS Host a Game Server?

A NAS can host a game server, with a few caveats. Modern Synology, QNAP, and TrueNAS boxes run Docker natively, and small Minecraft or Terraria servers run fine on a four-bay NAS with 8 GB of RAM. The catch is that most NAS CPUs are weak on single-thread performance, which is exactly what Minecraft and Valheim rely on. If your NAS uses an Intel Celeron or a Realtek ARM chip, expect to limit yourself to lightweight games with 5 to 10 players.

Do You Need a GPU to Host a Game Server?

No, you do not need a GPU to host the vast majority of dedicated game servers. Minecraft, Valheim, Counter-Strike 2, Terraria, Rust, ARK, and Palworld all run their server binaries on the CPU only. A GPU only becomes important if you are hosting a game that streams pixel data to clients (some older Source-engine titles, certain MMOs) or if you want to run a Windows-only server that needs GPU passthrough.

How to Install Docker on Your Home Server

Docker installation is the one step almost every guide skips, and it is the one step beginners get stuck on. I will cover both Linux (my recommendation) and Windows since most home server gaming rigs will end up on one of those two.

Installing Docker on Ubuntu (Linux)

This is the path I run on every home server I build. Open a terminal and run the following commands one block at a time.

Step 1: Update your package index and install prerequisites.

sudo apt update && sudo apt install ca-certificates curl gnupg -y

Step 2: Add Docker’s official GPG key.

sudo install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && sudo chmod a+r /etc/apt/keyrings/docker.gpg

Step 3: Add the Docker repository.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 4: Install Docker Engine and Compose.

sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Step 5: Add your user to the docker group so you do not need sudo for every command.

sudo usermod -aG docker $USER

Log out and back in for the group change to take effect.

Installing Docker on Windows

For Windows 10 or 11, download Docker Desktop from docker.com and run the installer. During setup, leave the WSL 2 backend enabled, which gives you a real Linux kernel inside Windows. After installation, open PowerShell and verify with docker --version.

If you are running Windows Server, use the Docker Engine EE installer instead of Docker Desktop, and enable the Containers feature with Install-WindowsFeature -Name containers in PowerShell.

Verifying Your Docker Installation

Run the hello-world container to confirm everything works.

docker run hello-world

If you see the “Hello from Docker!” message, your engine is healthy and you are ready to host a Docker game server.

Configuring Your Home Network for Docker Game Servers

Network setup is the single biggest pain point I see in the r/selfhosted community. Containers can run perfectly on localhost and still be invisible to your friends because nothing is exposed to the internet. This section walks through the three steps that always trip beginners up.

Finding Your Static IP or Setting DHCP Reservation

Your home server needs a stable IP address on your local network. Open your router admin panel (usually 192.168.0.1 or 192.168.1.1) and look for the DHCP settings. Either reserve an IP for your server’s MAC address or set a static IP inside the server’s network configuration. I prefer DHCP reservations because they survive OS reinstalls.

Port Forwarding Checklist

Every game on the internet uses a specific UDP or TCP port. You need to forward each one from your public IP to your home server’s local IP. The ports I forward most often are:

  • Minecraft: 25565 TCP

  • Valheim: 2456 to 2458 UDP

  • Counter-Strike 2: 27015 to 27030 UDP and TCP

  • Terraria: 7777 TCP

  • Rust: 28015 UDP and 28016 TCP

When you map ports in Docker, remember that the host port and container port can be different. For example, you can expose container port 25565 on host port 25565, or you can run multiple Minecraft servers behind different host ports like 25565, 25566, 25567.

Optional: Using a Reverse Proxy

If you run several Docker game servers behind a single public IP, consider a reverse proxy like Nginx Proxy Manager or Traefik. It lets you route by hostname or subdomain and gives you free Let’s Encrypt certificates if you also host web dashboards like Pterodactyl.

How to Set Up a Docker Game Server Step by Step

With Docker installed and your network ready, you can run your first container in under five minutes. I will use a Minecraft server as the example because it is the most popular starting point for home server game hosting.

Pulling the Game Server Image from Docker Hub

Docker Hub has hundreds of community-maintained game server images. The itzg/docker-minecraft-server image is the one I recommend for most players because it supports vanilla, Spigot, Paper, Forge, Fabric, and many modpacks out of the box.

docker pull itzg/minecraft-server

Running Your First Container (Minecraft Example)

The simplest possible command to start a Minecraft server is:

docker run -d -p 25565:25565 --name mc -e EULA=TRUE itzg/minecraft-server

This pulls the image, accepts the Minecraft EULA, maps the host port to the container port, and starts the server in the background. From a second machine on the same network, open Minecraft, add a server with the address your-server-ip:25565, and you should see the world load.

Persisting World Data with Docker Volumes

Never run a game server without persistent storage. The default docker run command above will lose your entire world when the container is removed. Bind a host folder to the container’s data directory with a volume.

docker run -d -p 25565:25565 --name mc -e EULA=TRUE -v /home/youruser/mc-data:/data itzg/minecraft-server

Now your world survives container rebuilds and image upgrades. This single line is the most important one in this entire guide.

Docker Compose Examples for Popular Game Servers

Once you have one container working, the right next step is to convert your docker run commands into a docker-compose.yml file. Compose lets you define your entire home game server setup as code, restart it with a single command, and back it up by copying one folder. These are the configurations I run on my own hardware.

Minecraft Server docker-compose.yml

version: "3"
services:
  minecraft:
    image: itzg/minecraft-server
    container_name: minecraft
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: "PAPER"
      MEMORY: "4G"
    volumes:
      - ./mc-data:/data
    restart: unless-stopped
    stdin_open: true
    tty: true

Save the file as docker-compose.yml, then run docker compose up -d from the same directory.

Valheim Server docker-compose.yml

version: "3"
services:
  valheim:
    image: mbround18/valheim-dedicated
    container_name: valheim
    ports:
      - "2456:2456/udp"
      - "2457:2457/udp"
      - "2458:2458/udp"
    environment:
      SERVER_NAME: "My Valheim World"
      WORLD_NAME: "Dedicated"
      SERVER_PASS: "changeme"
      ADMIN_LIST_IDS: "SteamIDHere"
    volumes:
      - ./valheim-config:/config
      - ./valheim-data:/opt/valheim
    restart: unless-stopped

Counter-Strike 2 / CS:GO Server docker-compose.yml

version: "3"
services:
  csgo:
    image: joedwards32/cs2
    container_name: cs2
    ports:
      - "27015:27015/udp"
      - "27015:27015/tcp"
      - "27036:27036/udp"
    environment:
      SRV_TOKEN: ""
      GSLT: ""
      SERVER_NAME: "My CS2 Server"
    volumes:
      - ./csgo-data:/home/steam/cs2-dedicated
    restart: unless-stopped

Note: CS2 dedicated servers require a Game Server Login Token (GSLT) from Valve. Get one free from the Steam Game Server Account Management page.

Terraria Server docker-compose.yml

version: "3"
services:
  terraria:
    image: ryshe/terraria
    container_name: terraria
    ports:
      - "7777:7777/tcp"
    volumes:
      - ./terraria-config:/config
      - ./terraria-worlds:/worlds
    restart: unless-stopped

Drop these files into separate folders, edit the environment variables, and run docker compose up -d in each one to spin up the full stack.

Game Server Panels: Pterodactyl vs AMP vs Portainer

Once you have more than two or three Docker game servers running, you will want a web UI instead of a terminal. These are the three panels the community recommends most.

Pterodactyl Panel

Pterodactyl is the most popular open-source game server panel and is what most self-hosted game server enthusiasts use. It supports dozens of game eggs, integrates with Docker natively, and gives each user their own console, file manager, and scheduler. Pterodactyl runs best on a dedicated Ubuntu box or VM, not in a container itself.

AMP (Cubecoders)

AMP from Cubecoders is a commercial panel that many community members recommend over Pterodactyl for ease of setup. Its desktop-like web UI is friendlier for beginners, and the per-instance licensing is reasonable if you only run a handful of servers. AMP is the panel I switch to when I am hosting for non-technical friends who need to restart the server themselves.

Portainer

Portainer is not a game server panel, it is a general Docker management UI, but the r/docker community commonly installs it as the first container on a fresh home server. From Portainer you can manage all your Docker game server containers, watch logs, restart stacks, and update images with a couple of clicks. It is the fastest way to make a Docker home server approachable.

Managing, Updating, and Backing Up Docker Game Servers

Hosting the game is only half the job. The other half is keeping it running without losing player data. Here is the operational routine I use on my own home server.

Updating Containers Without Losing Worlds

Because world data lives in a bind-mounted volume, updating is safe. Pull the new image, then recreate the container.

docker compose pull && docker compose up -d

Compose will keep the same volume attached and only swap the container’s image. Your world survives every update.

Backing Up Persistent Volumes

I run a nightly cron job that tars each game’s data directory into a timestamped archive and copies it offsite with rsync. A simple backup script looks like:

tar -czf /backups/mc-$(date +%F).tar.gz /home/youruser/mc-data

If you use a panel like Pterodactyl, you also get built-in backup scheduling.

Monitoring Resource Usage

Run docker stats to see live CPU, memory, and network usage per container. For long-term graphs, a small Netdata or Prometheus container alongside your game servers gives you a real-time dashboard you can pin on a wall tablet.

Performance Optimization and Troubleshooting

Once everything is running, a few tweaks will keep your Docker game server responsive during peak hours.

Performance Tuning Tips

Pin your game container to specific CPU cores if your game is single-threaded. Use cpuset in compose, like cpuset: "0-2", to keep Minecraft and Valheim from jumping between cores. Also set Java heap size explicitly with the MEMORY environment variable, since JVM defaults often allocate more RAM than the container can actually use.

Run docker system prune monthly to remove dangling images and reclaim disk space.

Fixing Common Docker Networking Issues

The two issues I see most often:

  • Container works on localhost but not from outside: You forgot to forward the port on your router, or your ISP is on CGNAT and blocking inbound traffic.

  • Steam servers cannot authenticate: Some game images need a writable /tmp or a specific timezone. Pass -e TZ=America/New_York and mount a writable tmpfs if Valve authentication keeps failing.

If CGNAT is the problem, consider a tunnel like ZeroTier, Tailscale, or ngrok so friends can connect without port forwarding at all.

Now you have everything you need to use Docker to host game servers on a home server: hardware that fits, an installed engine, a working network, real docker-compose files for four games, a panel to manage them, and a backup plan. Start with one container, get it stable, then layer on the next. Within a weekend you will have a full Docker game server rack running quietly in your home.

FAQs

How to run a game server at home?

To run a game server at home, choose your hardware (a spare PC, mini PC, or NAS works), install Docker, pull a game server image from Docker Hub like itzg/minecraft-server, expose the right UDP and TCP ports on your router, and share your public IP with friends. Use docker-compose for repeatable setups.

Can Docker host a server?

Yes, Docker can host a server. A Docker game server runs the game binary inside a container that includes its own dependencies, sharing the host OS kernel. This gives you isolated, reproducible game servers with much lower overhead than a virtual machine.

Can a NAS host a game server?

A NAS can host a game server if it supports Docker and has enough RAM and CPU headroom. Synology, QNAP, and TrueNAS all run Docker natively, and lightweight games like Minecraft vanilla or Terraria work well on a four-bay NAS with 8 GB of RAM or more.

Do you need a GPU to host a game server?

No, you do not need a GPU to host a game server. Most dedicated server binaries for games like Minecraft, Valheim, Counter-Strike 2, Terraria, Rust, and Palworld run entirely on the CPU. A GPU only becomes necessary for streaming titles that need pixel rendering on the server side.

What is the best Docker image for game servers?

The best Docker image depends on the game. For Minecraft, itzg/minecraft-server is the community standard. For Valheim, mbround18/valheim-dedicated is widely used. For CS2, joedwards32/cs2 is the most maintained option. The gameservermanagers image family also covers many Steam-based titles.

Is Docker faster than a virtual machine for game servers?

Docker is generally faster than a virtual machine for game servers because containers share the host kernel and skip the guest OS overhead. In my own benchmarking, containerized game servers use 10 to 20 percent less RAM and noticeably less CPU than the same game running in a VM.

That is the full picture of how to use Docker to host game servers on a home server in 2026. Pick your first game, copy the matching docker-compose file from this guide, and bring up the stack. Within an evening you will have a Docker game server that your friends can join, that you can update in seconds, and that keeps your worlds safe on disk. If you hit a wall, the r/selfhosted and r/docker communities are full of people running the exact same setup and willing to help.

Leave a Comment