Skip to content
CyberNex Logo
Valheim server Docker Compose setup guide showing docker-compose.yml configuration, world settings, and server management
guides

Valheim Server Docker Compose Setup Guide - Self-Host Tutorial 2026

Roshan DavidJuly 6, 202610 min read
Roshan David avatar
Roshan David
Game Server Engineer at CyberNex | 6+ years infrastructure experience

Running a Valheim dedicated server with Docker Compose gives you automated deployment, easy updates, persistent world data, and straightforward management. Whether you're hosting for friends or running a public Viking community, Docker simplifies the entire process. Here's the complete step-by-step guide for 2026.

01

Prerequisites

You'll need: a Linux VPS or dedicated server (Ubuntu 22.04 recommended) with at least 4GB RAM and 2 vCPU cores for a 10-player Valheim server. Docker and Docker Compose installed (use Docker's official installation script). Ports 2456-2458 UDP open on your firewall (these are the Valheim game ports). Basic familiarity with the command line and editing YAML files. A valid Steam account and the Valheim Dedicated Server app (downloaded automatically by Docker). For 20+ players, we recommend 8GB RAM and 4 vCPU cores. CyberNex VPS plans start at $15.76/month with high-performance CPUs and NVMe storage - more than capable for a Valheim server.

02

Docker Compose Configuration

Create a docker-compose.yml file with the official Valheim Docker image (lloesche/valheim-server is the most maintained in 2026). Basic configuration: set SERVER_NAME to your world name, WORLD_NAME to your save file name, SERVER_PASS for server password (min 5 chars), SERVER_PORT to 2456, and SERVER_PUBLIC to 1 (true) if you want the server visible in the community list. Map port 2456-2458/udp on your host to the container. Mount a volume for /config to persist world data across container restarts. Mount a volume for /opt/valheim/backups for automatic backups. Set environment variables for automatic updates (UPDATE_ON_STARTUP=1) and backup frequency (BACKUPS=1, BACKUPS_INTERVAL=3600 for hourly).

03

Deploying Your Valheim Server

Place docker-compose.yml in your server directory (e.g., /opt/valheim/). Run 'docker compose up -d' to start in detached mode. Check logs with 'docker compose logs -f' - look for 'Game server connected' message which indicates the server is ready. The first launch downloads the Valheim server files (1-2GB), so wait 5-10 minutes. Verify the server is running with 'docker ps' - you should see your container listed. Connect to your server in Valheim by going to Join Game > Community and searching for your server name, or use Join by IP and enter your server's IP:2456. Important: Valheim uses Steam Networking, so your server appears in the community list automatically if SERVER_PUBLIC=1.

04

Valheim Server Configuration Options

The Docker image supports all Valheim server settings via environment variables: WORLD_NAME (your world name - creates new if doesn't exist), SERVER_PASS (password for players, leave empty for open server), SERVER_NAME (display name in server list), SERVER_PORT (default 2456), SERVER_PUBLIC (1 = visible publicly, 0 = friends only), UPDATE_ON_STARTUP (1 = auto-update on container start), BACKUPS (1 = enable automatic backups), BACKUPS_INTERVAL (seconds between backups, default 3600), BACKUPS_DIRECTORY (where backups are stored), BACKUPS_MAX_AGE (days to keep backups, default 3), MOD_ENABLED (1 for mod support via BepInEx), and WORLD_SEED (pre-set seed for world generation). Environment variables are set in docker-compose.yml under 'environment:'.

05

World Management and Backups

World files are stored in the /config volume you mapped. The world consists of .fwl (world metadata) and .db (world database) files. Backups are handled automatically if BACKUPS=1 - the container creates timestamped backups of your world files. To restore: stop the container, copy a backup .fwl and .db file into the /config/worlds_local directory, rename them to match your WORLD_NAME, and restart. Manual backup: 'docker exec [container] vhserver backup'. To migrate worlds from another server: copy the .fwl and .db files to the /config/worlds_local directory on your new server, update WORLD_NAME to match the file names, and restart.

06

Mod Support with BepInEx

The Docker image supports Valheim mods via BepInEx. Enable with MOD_ENABLED=1 in environment variables. Mods are installed in the /config/bepinex/plugins directory inside the container. For Valheim Plus: download from Nexus Mods or the Valheim Plus GitHub, place the .dll files in /config/bepinex/plugins, configure via /config/bepinex/config/valheim_plus.cfg, and restart the container. Popular mods for 2026: Valheim Plus (quality of life and gameplay tweaks), Epic Loot (loot system), Creature Level and Loot Control (difficulty scaling), BetterUI (improved user interface), and Plant Everything (farming improvements). Note: all players must have the same mods installed to connect. Keep mods updated - Valheim updates frequently break mod compatibility.

07

Performance Tuning

Valheim is surprisingly CPU-intensive due to its physics simulation. Optimization tips: set 'SAVEDIR=./worlds_local:/config/worlds_local' in docker-compose to ensure worlds use the right storage (NVMe is ideal - CyberNex VPS uses NVMe). Limit player count to match your hardware (4GB RAM ~10 players, 8GB ~20+ players). Configure auto-restart: 'restart: unless-stopped' in docker-compose.yml ensures the server comes back after crashes. Use Docker's resource limits to prevent the Valheim server from consuming all resources: add 'deploy: resources: limits: cpus: '2', memory: 4G' to docker-compose.yml. Monitor with 'docker stats' to see CPU and RAM usage. For large worlds (200+ in-game days), consider increasing RAM or reducing the number of player-built structures (each structure ticks physics).

08

Alternative: Managed Valheim Hosting

If Docker and Linux administration isn't your thing, managed Valheim hosting is a plug-and-play alternative. CyberNex offers Valheim server hosting with: one-click Docker deployment (we handle the docker-compose), automatic world backups every 6 hours, 17 Tbit DDoS protection, Pterodactyl control panel with file manager and console, one-click mod installers for Valheim Plus and popular mods, and automatic server updates on release. Plans start at $5.77/month for a 4 GB (10-slot) server - often cheaper than running your own VPS when you factor in time spent on setup and maintenance. Self-hosting with Docker gives you maximum control and is great for learning, but managed hosting saves time and guarantees uptime.

Key Takeaways

Docker Compose makes Valheim server hosting clean, reproducible, and maintainable. With the lloesche/valheim-server image, you get automatic updates, backups, mod support, and world persistence out of the box. Set it up on a CyberNex VPS for maximum performance with NVMe storage and high-performance CPUs, or use our managed Valheim hosting for a one-click solution. Either way, your Viking adventure awaits.

Roshan David avatar
Roshan David
Game Server Engineer

Roshan is a game server engineer at CyberNex specializing in Minecraft, FiveM, and Rust server optimization. He writes hands-on tutorials and performance guides based on real-world deployment experience across CyberNex's global network.

CredentialsGame server engineer at CyberNex with 6+ years of infrastructure experience. Previously engineered low-latency gaming networks at Sri Lanka's largest ISP and holds certifications in Linux system administration and network security.

valheim server docker composevalheim docker setupvalheim dedicated server dockerdocker compose valheimvalheim server hosting dockervalheim self hostvalheim docker compose tutorial
Share this article
Valheim Server Docker Compose Setup Guide - Self-Host Tutorial 2026 | CyberNex