Tools: How to Self-Host a Valheim Server with Docker

Tools: How to Self-Host a Valheim Server with Docker

Why Self-Host a Valheim Server?

Prerequisites

Docker Compose Configuration

Connecting to Your Server

Automatic Updates and Restarts

Backups

Crossplay (Xbox/PC Game Pass)

Admin Controls

Adding Admins

Banning Players

Allowlist Mode

BepInEx Mods

Troubleshooting

Server Does Not Appear in Browser

Players Get Disconnected Frequently

World Save Corruption

Verdict

Related A self-hosted Valheim server runs 24/7, so your friends can play even when you are offline. Unlike renting from a game server provider, you control world settings, mods, and backups — and you pay nothing beyond the hardware cost. The lloesche/valheim-server Docker image handles SteamCMD, automatic updates, scheduled restarts, and hourly backups out of the box. Official project: lloesche/valheim-server-docker on GitHub First startup takes 5-10 minutes while SteamCMD downloads Valheim server files (~1 GB). Watch progress with: The server is ready when you see Game server connected. For LAN play, use the server's local IP. For internet play, forward UDP ports 2456-2457 on your router. Alternatively, use Tailscale for zero-config access without port forwarding. The image checks for Valheim updates every 15 minutes by default. When an update is available and no players are online (if UPDATE_IF_IDLE is true), it downloads and installs the update automatically. To disable automatic updates entirely, set UPDATE_CRON: "". Backups are enabled by default. The image creates compressed world backups every hour and cleans up backups older than 3 days. Backups are stored in /config/backups/ inside the container (mapped to ./valheim-config/backups/ on the host). For additional backup strategies, see our backup guide. To allow non-Steam clients (Xbox, PC Game Pass) to connect: Add port 2458 to your port mappings: Crossplay uses PlayFab instead of Steam networking. Both Steam and non-Steam players can connect simultaneously when crossplay is enabled. Set admin SteamID64s via environment variable: Find your SteamID64 at steamid.io. Restrict access to specific players only: When PERMITTEDLIST_IDS is set, only those SteamID64s can join the server. To enable BepInEx modding framework: The BepInEx framework installs automatically on next restart. Place mod DLLs in ./valheim-config/bepinex/plugins/: Note: BepInEx and ValheimPlus are mutually exclusive. BepInEx is the more actively maintained framework and supports most mods on Thunderstore. Symptom: SERVER_PUBLIC: "true" but the server is not listed. Symptom: Players kicked with "Disconnected" after a few minutes. Symptom: Server starts with a fresh world despite existing saves. Valheim is CPU-bound. A 4-core CPU at 4.0 GHz will perform noticeably better than an 8-core at 2.5 GHz. If you experience tick lag with many players, prioritize clock speed. Idle server RAM usage is approximately 2.8 GB, with each connected player adding 100-200 MB. The lloesche/valheim-server image is the best way to run a Valheim dedicated server. Built-in automatic updates, scheduled backups, and graceful shutdown handling mean the server mostly runs itself. BepInEx support covers the modding ecosystem. The only downside is that the image uses rolling tags rather than semantic versions — pin to a specific SHA if you need exact reproducibility. For managing multiple game servers including Valheim, look at Pterodactyl or Crafty Controller. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Code Block

Copy

services: valheim: image: ghcr.io/lloesche/valheim-server container_name: valheim-server cap_add: - sys_nice ports: - "2456-2457:2456-2457/udp" environment: SERVER_NAME: "My Valheim Server" SERVER_PASS: "atleast5chars" WORLD_NAME: "MyWorld" SERVER_PUBLIC: "false" TZ: "America/New_York" UPDATE_CRON: "*/15 * * * *" UPDATE_IF_IDLE: "true" RESTART_CRON: "0 5 * * *" RESTART_IF_IDLE: "true" BACKUPS: "true" BACKUPS_CRON: "0 * * * *" BACKUPS_ZIP: "true" BACKUPS_MAX_AGE: "3" volumes: - ./valheim-config:/config - ./valheim-data:/opt/valheim restart: unless-stopped stop_grace_period: 120s services: valheim: image: ghcr.io/lloesche/valheim-server container_name: valheim-server cap_add: - sys_nice ports: - "2456-2457:2456-2457/udp" environment: SERVER_NAME: "My Valheim Server" SERVER_PASS: "atleast5chars" WORLD_NAME: "MyWorld" SERVER_PUBLIC: "false" TZ: "America/New_York" UPDATE_CRON: "*/15 * * * *" UPDATE_IF_IDLE: "true" RESTART_CRON: "0 5 * * *" RESTART_IF_IDLE: "true" BACKUPS: "true" BACKUPS_CRON: "0 * * * *" BACKUPS_ZIP: "true" BACKUPS_MAX_AGE: "3" volumes: - ./valheim-config:/config - ./valheim-data:/opt/valheim restart: unless-stopped stop_grace_period: 120s services: valheim: image: ghcr.io/lloesche/valheim-server container_name: valheim-server cap_add: - sys_nice ports: - "2456-2457:2456-2457/udp" environment: SERVER_NAME: "My Valheim Server" SERVER_PASS: "atleast5chars" WORLD_NAME: "MyWorld" SERVER_PUBLIC: "false" TZ: "America/New_York" UPDATE_CRON: "*/15 * * * *" UPDATE_IF_IDLE: "true" RESTART_CRON: "0 5 * * *" RESTART_IF_IDLE: "true" BACKUPS: "true" BACKUPS_CRON: "0 * * * *" BACKUPS_ZIP: "true" BACKUPS_MAX_AGE: "3" volumes: - ./valheim-config:/config - ./valheim-data:/opt/valheim restart: unless-stopped stop_grace_period: 120s docker compose up -d docker compose up -d docker compose up -d docker compose logs -f valheim docker compose logs -f valheim docker compose logs -f valheim docker compose down cd valheim-config/backups/ # Unzip the desired backup unzip backup-YYYYMMDD-HHMMSS.zip -d ../worlds_local/ docker compose up -d docker compose down cd valheim-config/backups/ # Unzip the desired backup unzip backup-YYYYMMDD-HHMMSS.zip -d ../worlds_local/ docker compose up -d docker compose down cd valheim-config/backups/ # Unzip the desired backup unzip backup-YYYYMMDD-HHMMSS.zip -d ../worlds_local/ docker compose up -d environment: SERVER_ARGS: "-crossplay" environment: SERVER_ARGS: "-crossplay" environment: SERVER_ARGS: "-crossplay" ports: - "2456-2458:2456-2458/udp" ports: - "2456-2458:2456-2458/udp" ports: - "2456-2458:2456-2458/udp" environment: ADMINLIST_IDS: "76561198012345678 76561198087654321" environment: ADMINLIST_IDS: "76561198012345678 76561198087654321" environment: ADMINLIST_IDS: "76561198012345678 76561198087654321" environment: BANNEDLIST_IDS: "76561198099999999" environment: BANNEDLIST_IDS: "76561198099999999" environment: BANNEDLIST_IDS: "76561198099999999" environment: PERMITTEDLIST_IDS: "76561198012345678 76561198087654321" environment: PERMITTEDLIST_IDS: "76561198012345678 76561198087654321" environment: PERMITTEDLIST_IDS: "76561198012345678 76561198087654321" environment: BEPINEX: "true" environment: BEPINEX: "true" environment: BEPINEX: "true" cp my-valheim-mod.dll ./valheim-config/bepinex/plugins/ docker compose restart valheim cp my-valheim-mod.dll ./valheim-config/bepinex/plugins/ docker compose restart valheim cp my-valheim-mod.dll ./valheim-config/bepinex/plugins/ docker compose restart valheim - A Linux server (Ubuntu 22.04+ recommended) with Docker and Docker Compose installed - 4 GB of RAM minimum (8 GB recommended) - 2+ CPU cores — clock speed matters more than core count for Valheim - 5 GB of free disk space (plus world save growth over time) - UDP ports 2456-2457 open on your firewall or router (port forwarding guide) - Click Join Game → Add Server - Enter your-server-ip:2456 - Enter the password you set in SERVER_PASS - Wait 10-15 minutes after startup — Steam registration can be slow - Verify UDP ports 2456-2457 are forwarded and reachable - Connect directly by IP (your-ip:2456) instead of using the browser - Check docker compose logs valheim for Steam registration errors - Ensure SERVER_PASS is at least 5 characters - Check server RAM usage — Valheim needs 4+ GB free - Verify the host's network is stable (packet loss causes disconnects) - If using crossplay, ensure port 2458/udp is also forwarded - Check that WORLD_NAME matches exactly (case-sensitive) - Verify ./valheim-config/worlds_local/ contains your .db and .fwl files - Restore from the latest backup in ./valheim-config/backups/ - Never use docker compose down -v — this deletes volumes and world data - Minecraft vs Valheim Server: Which to Self-Host? - How to Self-Host a Minecraft Server - Best Self-Hosted Game Servers - Pterodactyl vs Crafty Controller - Docker Compose Basics - Port Forwarding Guide - Tailscale Setup - Backup Strategy