27.08.2023

This page on the Valheim wiki details how to run servers.

Using Docker and the lloesche/valheim-server image§ 

lloesche/valheim-server is a Docker image made to run Valheim servers. It handles a couple of nice options, including automated backups. First, we will create a valheim directory. We will do everything in it. Then, we need to create a docker-compose.yaml file :

version: "3"

services: 
  valheim: 
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    volumes: 
      - ./config:/config
      - ./data:/opt/valheim
    ports: 
      - "2456-2457:2456-2457/udp"
      - "9003:9003/tcp"
    env_file:
      - ./valheim.env
    stop_grace_period: 2m

This requires that we set a couple of things :

SERVER_NAME=<Name of your server here !>
WORLD_NAME=<Name of the world>
SERVER_PASS=<Password>
SERVER_PORT=2456
SERVER_PUBLIC=false
STATUS_HTTP=true
STATUS_HTTP_PORT=9003
BACKUPS_MAX_AGE=7 # age of the last backup to keep
#POST_BACKUP_HOOK=mcli cp @BACKUP_FILE@ my-minio-bucket # this will be executed after a backup
BEPINEX=true

The world will be located in config/backups/worlds, and the backups in config/backups/. To launch the server, simply do a docker-compose up -d.

Updates§ 

As written in the README on Github, updates are applied automatically, when no player are connected.

Backups§ 

This section on Github contains all relevant informations. There are many things to be configured : backup interval, number of backups kept…s By default, the game create backups in config/backups/

World difficulty setting§ 

There is currently no way to easily select customize the world difficulty options, although there is an issue on the subject. The easiest way to change the world’s difficulty is to download the world, open it in singleplayer, and make the modifications there, before uploading the files back. On your client computer, the world save can be found in the following location :