experimental Docker file to run a Valheim server in a Raspberry Pi4
Go to file
Tranko b278f2422e
Example file to execute the valheim server
This file contains all the data to run the server.
2022-01-04 11:27:17 +00:00
README.md Update readme with Docker instructions 2021-10-23 12:01:10 +00:00
bootstrap Fixing typos 2022-01-04 11:26:38 +00:00
env.world Example file to execute the valheim server 2022-01-04 11:27:17 +00:00
valheim.Dockerfile Disable dynared for steamcmd 2021-10-10 15:55:40 +00:00

README.md

pi4valheim

Experimental Docker file to run a Valheim server in a Raspberry Pi4.

The valheim.Dockerfile is based on the stardart repositories of box86 and box64. The valheim2.DockerFile is based on alternative repository of box64 with a fixed memory issue that appears on the startup of the server.

Requeriments:

Raspberry Pi4: I only tested on a 8GB of RAM with the next requirements:

  • RaspianOs 64 Bits updated.
  • Upgrade the distribution to Debian BullsEye (change the repositories to):
deb http://deb.debian.org/debian           bullseye          main contrib non-free
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian           bullseye-updates  main contrib non-free

Then run the typical upgrade of Debian:

sudo apt update & sudo apt upgrade & sudo apt dist-upgrade
  • Install Podman v3.3.1 (The version that is in the Debian repository is old (3.0.1) and it does not work correctly in my case).
  • Install Docker (Tested on version 20.10.9)

Create the image (it will take around 1-2 hours)

If you use podman:

podman build -f valheim.Dockerfile
podman image tag c44a18e4e67d valheim-base:v1

If you use docker:

docker build --no-cache --tag valheim-base -f Valheim.dockerfile .

Execute the container

First step is to execute the container, it can be done in two ways depending of the networking configuration:

If you don't have the CNI network configured, you can use this command to execute the container.

podman run --name valheim --network host -v /home/pi/valheim_data:/root/valheim_data:rw -it valheim-base:v1 /bin/bash

If you have the CNI network configured you can use this command to execute the container:

podman run --rm --name valheim --network cni-podman1 -p 2456-2458:2456-2458/udp -v /home/pi/valheim_data:/root/valheim_data:rw -it valheim-base /bin/bash

If you use docker (I didn't test with cni network):

docker run --rm --name valheim --network host -v /home/pi/valheim_data:/root/valheim_data:rw -it valheim-base /bin/bash

Second step:

Create a start.sh copy from the start_server.sh and modify the execution with box64 in front. For example I execute my server with the next line to create a local network server to play at home. Also, as I had a previous world created, I connected it with a volumne in the execution of the container, so you can use "-savedir" to point to the world data:

nano start_server.sh

Modify the line of the execution of the server with your properties:

box64 ./valheim_server.x86_64 -public 0 -nographics -batchmode -name "Your server Name" -port 2456 -world "Your Workd Name" -savedir "/root/valheim_data"

Then, use Control + S and Control + X to save and exit the file

Third step

Start the server with the command:

./start_server.sh

Fourth step:

Stop the server with control + c as a the normal Valheim server.

Considerations:

Pi4 has a limited hardware, it this is emulating x86_64 over arm64, so don't expect so high performance. It works, I didn't have any problems playing some hours. When the game saves it freeze all connections during some seconds, take it into account!!!!! Several times it does not start correctly and fail (the emulator is not yet finished and it does not work all the times). In that cases, you need to stop the process killing the process.

This experiment can be done for the next projects: