Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

How to Run a Valheim Server in Docker on a Linux VPS

A practical, operations-focused guide to running Valheim in Docker on a Linux VPS, including Compose configuration, UDP ports, crossplay, world migration, backups and safe updates.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most practical setup is a maintained Valheim Docker image on a patched Linux VPS, with the server configuration mounted outside the container. Publish UDP ports 2456 and 2457 for the default Steam backend, allow the same ports in both your cloud and Linux firewalls, and keep /config backed up. The container can download and update the native dedicated-server files while your worlds, permissions and backups remain on the VPS.

This guide uses ghcr.io/community-valheim-tools/valheim-server. Image variables and tags can change, so check the image README before putting a deployment into production.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the Docker deployment actually does

Docker is not emulating Valheim. The image downloads the native dedicated-server files through SteamCMD, starts the server process, and presents its configuration directory as a volume. Replacing the container therefore does not have to replace your world: the persistent host directory is mounted back into the new container.

A useful layout has two host directories:

  • /srv/valheim/config mounted at /config. This is the important, portable directory containing world saves, server backups and admin, ban and whitelist files.
  • /srv/valheim/data mounted at /opt/valheim. This optional volume keeps the downloaded server files and SteamCMD depot cache, so a recreated container does not need to download everything again.

The container is disposable; the configuration directory is not. Treat that distinction as the foundation of your backup, migration and update plan.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

VPS requirements and sizing

One current container project gives the following starting points. They are project guidance, not a controlled performance benchmark. Actual load depends on player count, world activity, mods and whether crossplay is enabled.

Resource Starting point Recommended headroom
CPU 2 cores 4 cores
Memory 4 GB RAM 8 GB RAM
Disk About 1 GB free for the initial server download Additional capacity for worlds, logs and dated backups

Choose a VPS with a public IPv4 address unless your provider documents another reachable arrangement. Keep the operating system patched, and make sure your provider lets you create inbound UDP firewall rules. A small instance may run a lightly populated world, but leave room for world growth and backup copies rather than allocating only the download size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the Linux host

Install Docker and Compose

Install Docker Engine and the Compose plugin using your distribution’s supported packages, then verify that both commands work:

docker version
docker compose version

Use a normal administrative account with narrowly scoped sudo access for host maintenance. Do not expose the Docker API to the public internet.

Create persistent directories

sudo install -d -m 750 /srv/valheim/config
sudo install -d -m 750 /srv/valheim/data

Restrict these directories to the service account and administrators. The exact numeric user and group used inside an image can vary, so confirm the current image documentation before changing ownership; a permissions mismatch is a common cause of a container that starts and then fails to write a world.

Keep credentials out of casual shell history

The server password is supplied as an environment variable. Put the Compose file or an accompanying environment file under a directory readable only by administrators, and use a password of at least five characters. Do not put the password in SERVER_NAME; the container documentation says that an invalid password/name combination causes the server to refuse to start.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy the server with Docker Compose

Create /srv/valheim/compose.yml with a service like this:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
services:
  valheim:
    image: ghcr.io/community-valheim-tools/valheim-server
    container_name: valheim-server
    stop_grace_period: 120s
    ports:
      - '2456-2457:2456-2457/udp'
    volumes:
      - /srv/valheim/config:/config
      - /srv/valheim/data:/opt/valheim
    environment:
      SERVER_NAME: 'My Valheim Server'
      WORLD_NAME: 'Dedicated'
      SERVER_PASS: 'replace-with-a-long-password'
    # Optional: removes a thread-priority warning on supported hosts
    cap_add:
      - SYS_NICE

CAP_SYS_NICE is optional. It can remove a thread-priority warning, but it is not required for basic operation. If you do not need it, remove the cap_add block and run with fewer privileges.

Start the service from the directory containing the file:

cd /srv/valheim
docker compose up -d

The equivalent one-container command is useful when you do not want a Compose file:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker run -d 
  --name valheim-server 
  --stop-timeout 120 
  -p 2456-2457:2456-2457/udp 
  -v /srv/valheim/config:/config 
  -v /srv/valheim/data:/opt/valheim 
  -e SERVER_NAME='My Server' 
  -e WORLD_NAME='Dedicated' 
  -e SERVER_PASS='replace-with-a-long-password' 
  ghcr.io/community-valheim-tools/valheim-server

The first start downloads the dedicated-server files from Steam. The project describes that download as roughly 1 GB, so the initial boot can take several minutes. Do not assume that a newly created container is ready merely because Docker reports a running state.

Confirm that the first start completed

Read startup logs

docker compose logs -f valheim

Watch for download progress, configuration errors and the message indicating that the game server is ready. If the container exits, inspect the last log lines before changing anything:

docker compose ps
docker inspect valheim-server --format '{{.State.Status}} {{.State.ExitCode}}'
docker compose logs --tail=200 valheim

Stop following logs with Ctrl+C; that does not stop the container.

Check the published ports

docker port valheim-server
sudo ss -lunp | grep -E '2456|2457'

These checks establish that Docker published the ports and that the host has a UDP listener. They do not prove that a cloud firewall or an upstream NAT device permits traffic, so test from an actual Valheim client as well.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Open the right ports

Default Steam backend

Valheim uses the configured port and the next port. With the default port, that means UDP 2456 and UDP 2457. The Compose mapping above publishes both; opening only 2456 is an incomplete deployment.

Allow the pair in every firewall layer:

  1. In the VPS provider’s network or security-group firewall, allow inbound UDP 2456–2457.
  2. In the Linux firewall, allow the same UDP range. For a host using UFW, the rule is sudo ufw allow 2456:2457/udp.
  3. If the machine is behind another router or NAT gateway, forward UDP 2456 and 2457 to the VPS host.

Do not open a broad UDP range when two ports are sufficient. Keep SSH restricted separately to the administration addresses you actually use.

Connect from a client

Use the VPS public address and the configured game port in Valheim. A browser listing is not a reachability test: a server can appear in a listing while a firewall, wrong address or mismatched port still prevents a direct connection. Check logs, the host listener and an end-to-end client connection together.

Enable crossplay when players use different platforms

Set CROSSPLAY=true in the container environment when you want the image’s crossplay mode:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
environment:
  SERVER_NAME: 'My Crossplay Server'
  WORLD_NAME: 'Dedicated'
  SERVER_PASS: 'replace-with-a-long-password'
  CROSSPLAY: 'true'

After changing the Compose file, recreate the service with docker compose up -d. The official Valheim dedicated-server guidance says that the crossplay backend uses a relay and does not require router port forwarding. That changes the path through the internet; it does not remove the need to read the image’s current networking instructions or to keep your container configuration consistent.

If you switch between the default Steam backend and crossplay, record the change and test with a client from each target platform. Do not diagnose a crossplay connection as though it were a conventional direct UDP connection.

Where worlds and server files live

The /config directory is the migration unit

Everything you need to preserve the playable server should be under the host-mounted configuration directory. It contains world saves, backups and the admin, ban and whitelist files. Back up /srv/valheim/config, not merely the container ID or image layer.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

The optional /opt/valheim mount is operationally useful but less critical to world recovery. It preserves the downloaded server and SteamCMD cache, reducing download time after recreation. You can rebuild it; you cannot rebuild an unbacked-up world from the image.

Import an existing world

  1. Stop the service cleanly: docker compose down.
  2. Copy the existing world’s files into the image’s expected worlds_local location below /srv/valheim/config.
  3. Set WORLD_NAME to the existing world name, without changing the files’ names accidentally.
  4. Start the service and inspect the logs for the world-load result.

Image releases document different handling for legacy, pre-1.0 world files. Confirm the current path conventions before importing an old save; do not assume a file copied from another installation belongs in the same directory as a current save.

Migrate to another VPS

Install Docker on the destination, create the same host directories, copy the Compose file and restore the contents of /srv/valheim/config. Restore /srv/valheim/data too if you want to retain the server download and cache. Start only after the copy is complete, then verify the world name, password, ports and logs. The configuration directory is deliberately portable, which is why keeping it outside the container matters.

Back up before updates and migrations

Stop the server cleanly before taking a filesystem copy so the world is not changing during the snapshot:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd /srv/valheim
docker compose down
sudo tar -C /srv/valheim -czf /srv/valheim-config-$(date +%F).tgz config

Store at least one dated copy away from the VPS. A second copy on the same disk protects against an accidental container recreation, but not against disk failure or a compromised host. Keep backup permissions private because the archive includes administrative files and may include server secrets.

After the backup, bring the service back with docker compose up -d and verify that the expected world loads. If you use filesystem snapshots instead of tar, apply the same rule: capture /config consistently and retain the date in the snapshot name.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Update the image and the dedicated server safely

  1. Choose an image tag deliberately. Pin a tested version when reproducibility matters instead of silently following an unreviewed moving tag.
  2. Make a dated backup of /srv/valheim/config.
  3. Pull the replacement image: docker compose pull.
  4. Stop the old container cleanly, allowing the 120-second shutdown window: docker compose down.
  5. Recreate it with the same mounts and environment: docker compose up -d.
  6. Review startup logs and join with a client before declaring the update complete.

The image downloads and updates the dedicated server through Steam. Exact update timing and image-specific migration behavior can change, so read the current project documentation before automating updates. Never remove the host-mounted configuration directory as part of a container refresh.

Security practices that fit a game server

  • Use a long, unique server password and keep it out of public documentation and shell history.
  • Expose only the required UDP game ports. Do not expose Docker’s control socket or API.
  • Keep the VPS operating system, Docker packages and image tag maintained.
  • Run the service with a non-root host account where the image supports it, and use restrictive permissions on /srv/valheim.
  • Keep off-host backups inaccessible from the public web.
  • Review admin, ban and whitelist files after restoring a migration archive.

These controls reduce the impact of a leaked credential or compromised application, but they do not replace provider-level firewall rules and regular backups.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run more than one Valheim world

Give every instance its own container name, configuration directory, data directory and UDP port pair. The documented pattern spaces pairs as 2456/2457 for one server and 2458/2459 for the next. For a second Compose service, map 2458-2459:2458-2459/udp and configure the image’s corresponding game-port setting according to its current README; do not map two containers to the same host ports.

Back up each configuration directory separately. A failure in one world should not overwrite another world’s files, and separate directories make migration and rollback understandable.

Troubleshooting by symptom

Symptom Likely checks Corrective action
Container exits during startup Recent logs, environment-variable spelling, directory permissions Fix the variable or permissions, then recreate the container; do not delete the configuration directory.
Server is visible but clients cannot join UDP 2456 and 2457 in Docker, provider firewall, Linux firewall and any NAT rule Allow the complete pair and test with the VPS address and configured port.
World appears new after recreation Host bind mount and WORLD_NAME; contents of /srv/valheim/config Restore the correct configuration backup and use the existing world’s exact name.
First boot seems stuck Download progress and available disk space Allow several minutes for the roughly 1 GB Steam download; inspect logs before restarting repeatedly.
Thread-priority warning appears Whether CAP_SYS_NICE is present Ignore it for basic operation or add the optional capability if your host policy permits.
Cross-platform players cannot connect CROSSPLAY=true, client platform and current image instructions Enable the crossplay mode, recreate the service and test through the relay path rather than assuming router forwarding is required.
Update downloads the server again Whether /opt/valheim is mounted to the host Add the optional data bind mount; the world remains protected by the separate /config mount.

Packaged image or a hand-written container?

A maintained image reduces the amount of shell scripting you must own, but it also makes you dependent on its documented variables and release process. A hand-written Dockerfile or Compose wrapper gives you more control, yet you become responsible for SteamCMD installation, shutdown handling, updates and compatibility details.

Evaluate either approach on these operational criteria:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • How actively the image is maintained and how clearly releases are documented.
  • Whether environment-variable names and defaults remain stable.
  • Whether shutdown and backup behavior are explicit.
  • Support for mods or BepInEx if your community needs them.
  • Crossplay support and the resulting port requirements.
  • Ability to pin versions and reproduce a known-good deployment.
  • Quality of logs and recovery instructions.

For a first VPS, the maintained image with host-mounted /config and a pinned, tested tag is usually the lower-maintenance choice. Whichever path you select, keep the world data outside the container and test a restore before you need one.

Routine operating checklist

  • Confirm the VPS and Docker packages are patched.
  • Check container logs after restarts and image updates.
  • Verify that both required UDP ports remain allowed at the provider and host.
  • Take a dated, off-host copy of /srv/valheim/config.
  • Record the image tag, world name, port pair and whether crossplay is enabled.
  • Test a client connection after any firewall, image or world-file change.
  • Retain the previous image tag and backup until the new version has been proven in play.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.