lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.94k stars 271 forks source link

Server noch reachable/doesn't start correctly #114

Closed Shawak closed 3 years ago

Shawak commented 3 years ago

So I just tried to setup a valheim server but the server doesn't start correctly.

valheim/docker-compose.yml

version: '3.7'

services:
  valheim:
    image: lloesche/valheim-server
    volumes:
      - ./config:/config
      - server-data:/opt/valheim
    ports:
      - 2456-2458:2456-2458/udp

volumes:
  server-data:

valheim/config/config.cfg (there is also a valheim.cfg with the same content, because I couldn't figure out what the correct naming is)

SERVER_NAME="ServerName"
SERVER_PORT=2456
WORLD_NAME=WorldName
SERVER_PASS=secret
SERVER_PUBLIC=1
root@s1:~# netstat -tulpn
Proto Recv-Q Send-Q Local Address           Foreign Address         State 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      858/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      858/sshd
tcp6       0      0 :::10011                :::*                    LISTEN      1308/docker-proxy
tcp6       0      0 :::443                  :::*                    LISTEN      1195/docker-proxy
tcp6       0      0 :::80                   :::*                    LISTEN      1226/docker-proxy
tcp6       0      0 :::30033                :::*                    LISTEN      1291/docker-proxy
udp6       0      0 :::2456                 :::*                                9645/docker-proxy
udp6       0      0 :::2457                 :::*                                9633/docker-proxy
udp6       0      0 :::2458                 :::*                                9622/docker-proxy
udp6       0      0 :::9987                 :::*                                1333/docker-proxy

Log

[...]
UnloadTime: 1.818255 ms
02/27/2021 05:00:05: Starting to load scene:start
 (deflated 68%)
  adding: worlds/IDoxic.db2021-02-27 05:00:12,576 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
valheim-server: ERROR (not running)
valheim-server: started
 (deflated 68%)
  adding: worlds/IDoxic.fwl.old (deflated 5%)
2021-02-27 05:00:20 [101] (40) Removing backups older than 3 days
OK
 Update state (0x5) verifying install, progress: 0.10 (1048576 / 1051292475)
 Update state (0x5) verifying install, progress: 4.09 (42988735 / 1051292475)
 Update state (0x5) verifying install, progress: 9.92 (104250376 / 1051292475)
 Update state (0x5) verifying install, progress: 14.88 (156420400 / 1051292475)
 Update state (0x5) verifying install, progress: 18.67 (196266288 / 1051292475)
 Update state (0x5) verifying install, progress: 27.85 (292760779 / 1051292475)
 Update state (0x5) verifying install, progress: 37.25 (391637827 / 1051292475)
 Update state (0x5) verifying install, progress: 46.18 (485502107 / 1051292475)
 Update state (0x5) verifying install, progress: 54.69 (574971587 / 1051292475)
 Update state (0x5) verifying install, progress: 64.51 (678193859 / 1051292475)
 Update state (0x5) verifying install, progress: 69.77 (733479459 / 1051292475)
 Update state (0x5) verifying install, progress: 73.15 (768997347 / 1051292475)
 Update state (0x5) verifying install, progress: 76.35 (802621155 / 1051292475)
 Update state (0x5) verifying install, progress: 78.97 (830170819 / 1051292475)
 Update state (0x5) verifying install, progress: 82.33 (865527107 / 1051292475)
 Update state (0x5) verifying install, progress: 85.04 (893990627 / 1051292475)
 Update state (0x5) verifying install, progress: 88.04 (925514339 / 1051292475)
 Update state (0x5) verifying install, progress: 91.41 (960964963 / 1051292475)
 Update state (0x5) verifying install, progress: 95.14 (1000244099 / 1051292475)
 Update state (0x5) verifying install, progress: 98.91 (1039787651 / 1051292475)
Success! App '896660' fully installed.
2021-02-27 05:00:21 [13] (50) Received signal to check for update
.d..t...... ./
2021-02-27 05:00:21 [13] (40) Valheim Server is already the latest version
valheim-server: ERROR (already started)
2021-02-27 05:01:37,065 WARN received SIGTERM indicating exit request
2021-02-27 05:01:37,067 INFO waiting for valheim-backup, syslogd, valheim-server, valheim-updater, crond to die
2021-02-27 05:01:37 [13] (40) Releasing PID file /var/run/valheim-updater.pid
2021-02-27 05:01:37,927 INFO stopped: valheim-updater (exit status 0)
2021-02-27 05:01:37 [119] (40) Shutting down Valheim Server with PID 123
2021-02-27 05:01:37 [119] (50) Waiting for Valheim Server with PID 123 to shutdown
2021-02-27 05:01:40,962 INFO waiting for valheim-backup, syslogd, valheim-server, crond to die
2021-02-27 05:01:44,028 INFO waiting for valheim-backup, syslogd, valheim-server, crond to die
2021-02-27 05:01:44 [119] (50) Waiting for Valheim Server with PID 123 to shutdown
2021-02-27 05:01:47,049 INFO waiting for valheim-backup, syslogd, valheim-server, crond to die
2021-02-27 05:01:54,765 INFO Set uid to user 0 succeeded
Unlinking stale socket /var/run/supervisor.sock
2021-02-27 05:01:55,097 INFO RPC interface 'supervisor' initialized
2021-02-27 05:01:55,098 INFO supervisord started with pid 1
2021-02-27 05:01:56,103 INFO spawned: 'valheim-bootstrap' with pid 9
2021-02-27 05:01:56,109 INFO spawned: 'syslogd' with pid 10
2021-02-27 05:01:56,120 INFO spawned: 'crond' with pid 11
2021-02-27 05:01:56,131 INFO spawned: 'valheim-backup' with pid 12
2021-02-27 05:01:56,141 INFO spawned: 'valheim-updater' with pid 14
Feb 27 05:01:56 8bcd8a829b48 syslog.info syslogd started: BusyBox v1.32.1
Feb 27 05:01:56 8bcd8a829b48 cron.info crond[11]: crond (busybox 1.32.1) started, log level 8
2021-02-27 05:01:56,155 INFO success: valheim-bootstrap entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-02-27 05:01:56 [9] (40) Setting timezone Etc/UTC
2021-02-27 05:01:56 [14] (50) Running Valheim Server updater as user root uid 0
2021-02-27 05:01:56 [9] (50) Creating cron to do world backups using schedule 0 * * * *
2021-02-27 05:01:56 [9] (50) Creating cron to check for updates using schedule */15 * * * *
2021-02-27 05:01:56 [9] (50) Creating cron to restart valheim-server using schedule 0 5 * * *
2021-02-27 05:01:56 [14] (40) Downloading/updating/validating Valheim server from Steam
2021-02-27 05:01:56 [12] (40) Found existing pid file - checking process
2021-02-27 05:01:56,265 INFO exited: valheim-bootstrap (exit status 0; expected)
2021-02-27 05:01:56 [12] (50) Sending SIGUSR1 to PID 101
2021-02-27 05:01:56 [12] (40) Removing stale PID file and starting run
2021-02-27 05:01:56 [12] (40) Releasing PID file /var/run/valheim-backup.pid
2021-02-27 05:01:56 [12] (40) Backing up Valheim server worlds to /config/backups/worlds-20210227-050156.zip
  adding: worlds/ (stored 0%)
  adding: worlds/IDoxic.fwl (deflated 5%)
  adding: worlds/IDoxic.db.old2021-02-27 05:01:57,356 INFO success: syslogd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:01:57,357 INFO success: crond entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:01:57,358 INFO success: valheim-backup entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:01:57,358 INFO success: valheim-updater entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Redirecting stderr to '/root/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for user info... (deflated 68%)
  adding: worlds/IDoxic.db (deflated 68%)
  adding: worlds/IDoxic.fwl.old (deflated 5%)
2021-02-27 05:02:07 [12] (40) Removing backups older than 3 days
OK
 Update state (0x5) verifying install, progress: 0.00 (0 / 1051292475)
 Update state (0x5) verifying install, progress: 2.29 (24117248 / 1051292475)
 Update state (0x5) verifying install, progress: 6.49 (68256198 / 1051292475)
 Update state (0x5) verifying install, progress: 12.29 (129157424 / 1051292475)
 Update state (0x5) verifying install, progress: 21.67 (227830164 / 1051292475)
 Update state (0x5) verifying install, progress: 31.20 (327965955 / 1051292475)
 Update state (0x5) verifying install, progress: 41.08 (431847507 / 1051292475)
 Update state (0x5) verifying install, progress: 50.66 (532549955 / 1051292475)
 Update state (0x5) verifying install, progress: 60.73 (638480771 / 1051292475)
 Update state (0x5) verifying install, progress: 69.87 (734528035 / 1051292475)
 Update state (0x5) verifying install, progress: 78.67 (827063683 / 1051292475)
 Update state (0x5) verifying install, progress: 87.14 (916077155 / 1051292475)
 Update state (0x5) verifying install, progress: 95.04 (999195523 / 1051292475)
Success! App '896660' fully installed.
.d..t...... ./
2021-02-27 05:02:27 [14] (40) Valheim Server is already the latest version
2021-02-27 05:02:28,144 INFO spawned: 'valheim-server' with pid 101
2021-02-27 05:02:28 [101] (40) Running Valheim Server
Found path: /opt/valheim/server/valheim_server.x86_64
Mono path[0] = '/opt/valheim/server/valheim_server_Data/Managed'
Mono config path = '/opt/valheim/server/valheim_server_Data/MonoBleedingEdge/etc'
Preloaded 'libsteam_api.so'
Initialize engine version: 2019.4.20f1 (6dd1c08eedfa)
[Subsystems] Discovering subsystems at path /opt/valheim/server/valheim_server_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in  0.195 seconds
UnloadTime: 2.123043 ms
02/27/2021 05:02:28: Starting to load scene:start
2021-02-27 05:02:35,733 WARN received SIGTERM indicating exit request
2021-02-27 05:02:35,735 INFO waiting for valheim-backup, syslogd, valheim-server, valheim-updater, crond to die
2021-02-27 05:02:38,740 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
2021-02-27 05:02:38,740 INFO waiting for valheim-backup, syslogd, valheim-server, valheim-updater, crond to die
valheim-server: started
2021-02-27 05:02:38 [14] (40) Releasing PID file /var/run/valheim-updater.pid
2021-02-27 05:02:38,868 INFO stopped: valheim-updater (exit status 0)
2021-02-27 05:02:38 [101] (40) Shutting down Valheim Server with PID 105
2021-02-27 05:02:38 [101] (50) Waiting for Valheim Server with PID 105 to shutdown
2021-02-27 05:02:41,934 INFO waiting for valheim-backup, syslogd, valheim-server, crond to die
2021-02-27 05:02:44 [101] (50) Waiting for Valheim Server with PID 105 to shutdown
2021-02-27 05:02:44,941 INFO waiting for valheim-backup, syslogd, valheim-server, crond to die
2021-02-27 05:02:54,156 INFO Set uid to user 0 succeeded
Unlinking stale socket /var/run/supervisor.sock
2021-02-27 05:02:54,486 INFO RPC interface 'supervisor' initialized
2021-02-27 05:02:54,488 INFO supervisord started with pid 1
2021-02-27 05:02:55,492 INFO spawned: 'valheim-bootstrap' with pid 9
2021-02-27 05:02:55,496 INFO spawned: 'syslogd' with pid 10
2021-02-27 05:02:55,510 INFO spawned: 'crond' with pid 11
2021-02-27 05:02:55,516 INFO spawned: 'valheim-backup' with pid 12
2021-02-27 05:02:55,535 INFO spawned: 'valheim-updater' with pid 15
Feb 27 05:02:55 8bcd8a829b48 syslog.info syslogd started: BusyBox v1.32.1
2021-02-27 05:02:55,550 INFO success: valheim-bootstrap entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Feb 27 05:02:55 8bcd8a829b48 cron.info crond[11]: crond (busybox 1.32.1) started, log level 8
2021-02-27 05:02:55 [9] (40) Setting timezone Etc/UTC
2021-02-27 05:02:55 [15] (50) Running Valheim Server updater as user root uid 0
2021-02-27 05:02:55 [9] (50) Creating cron to do world backups using schedule 0 * * * *
2021-02-27 05:02:55 [9] (50) Creating cron to check for updates using schedule */15 * * * *
2021-02-27 05:02:55 [9] (50) Creating cron to restart valheim-server using schedule 0 5 * * *
2021-02-27 05:02:55 [15] (40) Downloading/updating/validating Valheim server from Steam
2021-02-27 05:02:55,681 INFO exited: valheim-bootstrap (exit status 0; expected)
2021-02-27 05:02:55 [12] (40) Found existing pid file - checking process
2021-02-27 05:02:55 [12] (50) Sending SIGUSR1 to PID 12
2021-02-27 05:02:55 [12] (30) Process with PID 12 already running - exiting
2021-02-27 05:02:55,742 INFO exited: valheim-backup (exit status 0; not expected)
2021-02-27 05:02:56,744 INFO success: syslogd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:02:56,745 INFO success: crond entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:02:56,748 INFO spawned: 'valheim-backup' with pid 55
2021-02-27 05:02:56,753 INFO success: valheim-updater entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-02-27 05:02:56 [55] (40) Found existing pid file - checking process
2021-02-27 05:02:56 [55] (50) Sending SIGUSR1 to PID 12
2021-02-27 05:02:56 [55] (40) Removing stale PID file and starting run
2021-02-27 05:02:56 [55] (40) Releasing PID file /var/run/valheim-backup.pid
2021-02-27 05:02:56 [55] (40) Backing up Valheim server worlds to /config/backups/worlds-20210227-050256.zip
  adding: worlds/ (stored 0%)
  adding: worlds/IDoxic.fwl (deflated 5%)
  adding: worlds/IDoxic.db.oldRedirecting stderr to '/root/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...2021-02-27 05:02:57,859 INFO success: valheim-backup entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Logged in OK
Waiting for user info... (deflated 68%)
  adding: worlds/IDoxic.db (deflated 68%)
  adding: worlds/IDoxic.fwl.old (deflated 5%)
2021-02-27 05:03:08 [55] (40) Removing backups older than 3 days
OK
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x5) verifying install, progress: 5.89 (61964742 / 1051292475)
 Update state (0x5) verifying install, progress: 12.09 (127060272 / 1051292475)
 Update state (0x5) verifying install, progress: 16.87 (177391920 / 1051292475)
 Update state (0x5) verifying install, progress: 22.25 (233944926 / 1051292475)
 Update state (0x5) verifying install, progress: 28.35 (298003659 / 1051292475)
 Update state (0x5) verifying install, progress: 36.65 (385346371 / 1051292475)
 Update state (0x5) verifying install, progress: 46.18 (485502107 / 1051292475)
 Update state (0x5) verifying install, progress: 55.49 (583360195 / 1051292475)
 Update state (0x5) verifying install, progress: 64.11 (673999555 / 1051292475)
 Update state (0x5) verifying install, progress: 73.76 (775451235 / 1051292475)
 Update state (0x5) verifying install, progress: 83.03 (872867139 / 1051292475)
 Update state (0x5) verifying install, progress: 92.30 (970333731 / 1051292475)
Success! App '896660' fully installed.
.d..t...... ./
2021-02-27 05:03:26 [15] (40) Valheim Server is already the latest version
2021-02-27 05:03:26,487 INFO spawned: 'valheim-server' with pid 110
2021-02-27 05:03:26 [110] (40) Running Valheim Server
Found path: /opt/valheim/server/valheim_server.x86_64
Mono path[0] = '/opt/valheim/server/valheim_server_Data/Managed'
Mono config path = '/opt/valheim/server/valheim_server_Data/MonoBleedingEdge/etc'
Preloaded 'libsteam_api.so'
Initialize engine version: 2019.4.20f1 (6dd1c08eedfa)
[Subsystems] Discovering subsystems at path /opt/valheim/server/valheim_server_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in  0.167 seconds
UnloadTime: 2.059308 ms
02/27/2021 05:03:27: Starting to load scene:start
2021-02-27 05:03:37,354 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
valheim-server: started

The CPU then starts running at 100%. It's only a small VPS so that's maybe the problem? But I am kinda curious about netstat not even showing a LISTEN state on desired ports.

lloesche commented 3 years ago

Thank you for your report.

Couple of things to fix before we dig deeper.

Delete everything in your config directory. There is no need to create any config files. The server will create them for you.

The values you defined like

SERVER_NAME="ServerName"
SERVER_PORT=2456
WORLD_NAME=WorldName
...

those are environment variables. Check https://github.com/lloesche/valheim-server-docker/blob/main/docker-compose.yaml for an example of how to set them.

When you start the server for the first time, make sure that /config and /opt/valheim are empty(!) directories and that the container is allowed to write in them.

That should be all to get you going. Let me know if that already fixes it.

Shawak commented 3 years ago

those are environment variables. Check https://github.com/lloesche/valheim-server-docker/blob/main/docker-compose.yaml for an example of how to set them.

Yeah I knew that, but I thought you can also set them in the config files. But I guess it doesn't matter, since the default port is the same and I tried to join with my servers IP address and that should work independent from my (missing) config settings.

So I changed my docker-compose.yml file to this:


version: '3.7'

services:
  valheim:
    image: lloesche/valheim-server
    volumes:
      - ./config:/config
      - server-data-empty:/opt/valheim
    ports:
      - 2456-2458:2456-2458/udp
    #network_mode: host

volumes:
  server-data:
  server-data-empty:

and moved my config folder to _config so the container can create an empty one; also I created a second volume for the server files in /opt/valheim and restarted everything agin.

But neither of that changed anything:

Mono path[0] = '/opt/valheim/server/valheim_server_Data/Managed'
Mono config path = '/opt/valheim/server/valheim_server_Data/MonoBleedingEdge/etc'
Preloaded 'libsteam_api.so'
Unable to load player prefs
Initialize engine version: 2019.4.20f1 (6dd1c08eedfa)
[Subsystems] Discovering subsystems at path /opt/valheim/server/valheim_server_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in  0.199 seconds
UnloadTime: 1.576323 ms
02/27/2021 13:29:22: Starting to load scene:start
2021-02-27 13:29:33,026 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
valheim-server: started

I got the same log output but the server is still not available, also my netstat output looks the same.

Simultaneously I ordered a new root server with two dedicated cores on a ryzen epyc 7702 and ran the example (which I also did on my other server at first):

docker run -d --name valheim-server -p 2456-2458:2456-2458/udp -e SERVER_NAME="My Server Test" -e WORLD_NAME="Neotopia" -e SERVER_PASS="secret" lloesche/valheim-server

And.. it instantly worked! I noticed that I got far more log output and it wont stuck on valheim-server: started e.g.:

02/27/2021 13:46:16: Authentication:k_ESteamNetworkingAvailability_Waiting
02/27/2021 13:46:16: Steam game server initialized
02/27/2021 13:46:16: Missing audio clip in music respawn
02/27/2021 13:46:16: Builder started
02/27/2021 13:46:17: Loaded localization English
2021-02-27 13:46:17,134 INFO success: valheim-server entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
valheim-server: ERROR (not running)
valheim-server: started
Unloading 16 unused Assets to reduce memory usage. Loaded Objects now: 85969.
Total: 61.541711 ms (FindLiveObjects: 5.004483 ms CreateObjectMapping: 12.106630 ms MarkObjects: 44.125385 ms  DeleteObjects: 0.294943 ms)
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 11.397881 ms
HDR Render Texture not supported, disabling HDR on reflection probe.
HDR Render Texture not supported, disabling HDR on reflection probe.
02/27/2021 13:46:17: Zonesystem Awake 178
02/27/2021 13:46:17: DungeonDB Awake 178
02/27/2021 13:46:17: Registering lobby
02/27/2021 13:46:17: Initializing world generator seed:Ezj4P0idxL ( -607781686 )   menu:False  worldgen version:1
02/27/2021 13:46:17: Using mountain distance: 1000
02/27/2021 13:46:17: Found 512 mountain points
02/27/2021 13:46:17: Remaining mountains:70
02/27/2021 13:46:17: Calc time 21.1 ms
02/27/2021 13:46:17: Found 7986 lake points
02/27/2021 13:46:19: Remaining lakes:118
02/27/2021 13:46:19: Calc time 2095.028 ms
02/27/2021 13:46:19: Rivers:162
02/27/2021 13:46:19: River buckets 15498
02/27/2021 13:46:19: River render time 277.255 ms
02/27/2021 13:46:19: River Calc time 288.993 ms
02/27/2021 13:46:20: River buckets 23946
02/27/2021 13:46:20: River render time 444.832 ms
02/27/2021 13:46:20: Placed 1897 streams
02/27/2021 13:46:20: Stream Calc time 982.649 ms
02/27/2021 13:46:20: Load world Neotopia
02/27/2021 13:46:20:   missing world.dat
02/27/2021 13:46:20: Audioman already exist, destroying self
Unloading 490 unused Assets to reduce memory usage. Loaded Objects now: 86302.
Total: 78.566061 ms (FindLiveObjects: 5.053225 ms CreateObjectMapping: 14.928500 ms MarkObjects: 54.881864 ms  DeleteObjects: 3.691171 ms)
02/27/2021 13:46:24: Zonesystem Start 178
02/27/2021 13:46:25: Generating locations
02/27/2021 13:46:25: Checking for location duplicates
02/27/2021 13:46:50: Failed to place all MountainWell1, placed 22 out of 25
02/27/2021 13:46:53: Failed to place all Runestone_Mountains, placed 84 out of 100
02/27/2021 13:46:53:  Done generating locations, duration:28337.88 ms
02/27/2021 13:46:53: DungeonDB Start 178
02/27/2021 13:46:53: Game server connected

So I guess it was just a resource problem. I hope my issue can help anyone with similar issues.

My final docker-compose.yml looks like this:

version: '3.7'

services:
  valheim:
    image: lloesche/valheim-server
    container_name: valheim-server
    restart: unless-stopped
    volumes:
      - ./config:/config
      - server-data:/opt/valheim
    ports:
      - 2456-2458:2456-2458/udp
    environment:
      - SERVER_NAME=My server
      - SERVER_PASS=secret
      - SERVER_PUBLIC=1
      - WORLD_NAME=World

volumes:
  server-data:

Thanks!