Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't recreate the entire server on restart #46

Open
insuusvenerati opened this issue Nov 5, 2022 · 17 comments · May be fixed by #47
Open

Don't recreate the entire server on restart #46

insuusvenerati opened this issue Nov 5, 2022 · 17 comments · May be fixed by #47

Comments

@insuusvenerati
Copy link

Reinstalling the Project Zomboid files every time the container restarts takes a great deal of time. Is there a way to check if the server files need updating before reinstalling?

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 5, 2022

It doesn't though.

This is where it checks if it is necessary to redownload.

The only thing that is redownloaded on a restart is the SteamCMD binary updating itself.
What is the issue you are seeing?

If you are finding that it redownloads every time, then you must be providing a new Volume every time.

@insuusvenerati
Copy link
Author

Well it starts off like this after I restart the server

zomboid_server | ### RCON not enabled: cannot issue quit command.
zomboid_server | Sending SIGTERM...
zomboid_server | 
zomboid_server | ### Project Zomboid Server stopped.
zomboid_server | 
zomboid_server | ### Setting variables...
zomboid_server | 
zomboid_server | ### Applying Pre Install Configuration...
zomboid_server | 
zomboid_server | ### Pre Install Configuration applied.
zomboid_server | 
zomboid_server | ### Updating Project Zomboid Server...
zomboid_server | Redirecting stderr to '/root/Steam/logs/stderr.txt'
zomboid_server | ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".
zomboid_server | [  0%] Checking for available update...
zomboid_server | [----] Download Complete.
zomboid_server | [----] Applying update...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Installing update...
zomboid_server | [----] Installing update...
zomboid_server | [----] Installing update...
zomboid_server | [----] Failed to apply update, reverting...
zomboid_server | [----] Verifying installation...
zomboid_server | [  0%] Downloading Update...
zomboid_server | [  0%] Checking for available update...
zomboid_server | [----] Download Complete.
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Extracting package...
zomboid_server | [----] Installing update...
zomboid_server | [----] Installing update...
zomboid_server | [----] Installing update...
zomboid_server | [----] Failed to apply update, reverting...
zomboid_server | Steam Console Client (c) Valve Corporation - local build
zomboid_server | -- type 'quit' to exit --
zomboid_server | Loading Steam API...OK
zomboid_server | @ShutdownOnFailedCommand 0
zomboid_server | "@ShutdownOnFailedCommand" = "0"
zomboid_server | @NoPromptForPassword 1
zomboid_server | "@NoPromptForPassword" = "1"
zomboid_server | force_install_dir /home/steam/ZomboidDedicatedServer
zomboid_server | 
zomboid_server | Connecting anonymously to Steam Public...OK
zomboid_server | Waiting for client config...OK
zomboid_server | Waiting for user info...OK
zomboid_server | app_update 380870 -beta public validate

After a few minutes of sitting there like that, it starts going into the verifying install state

zomboid_server |  Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
zomboid_server |  Update state (0x5) verifying install, progress: 1.24 (65657738 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 1.91 (101086574 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 3.59 (189798983 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 4.95 (261894455 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 6.12 (323915047 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 7.25 (383785923 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 8.22 (434819487 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 9.25 (489589343 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 10.51 (556243083 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 11.41 (603495103 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 12.55 (664132339 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 13.68 (723519923 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 14.74 (779876935 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 15.62 (826384379 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 16.68 (882509399 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 17.94 (949062559 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 18.94 (1002246591 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 20.29 (1073243063 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 21.30 (1127171771 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 22.47 (1188648815 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 23.71 (1254268107 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 24.75 (1309234103 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 26.18 (1385135667 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 27.27 (1442858063 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 28.52 (1509098219 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 29.45 (1557917675 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 30.65 (1621602975 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 32.11 (1699021163 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 33.00 (1746174791 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 34.23 (1810844363 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 35.25 (1865122663 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 36.08 (1908858117 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 36.44 (1927806781 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 36.74 (1944050379 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 37.05 (1959951745 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 37.36 (1976415616 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 37.55 (1986839932 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 37.77 (1998164653 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 37.94 (2007050923 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 38.33 (2028051012 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 39.49 (2089447350 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 39.65 (2097672884 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 40.40 (2137570169 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 41.04 (2171084290 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 41.74 (2208076403 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 41.96 (2219851897 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 42.08 (2226278582 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 42.41 (2243671975 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 42.88 (2268654177 / 5290686332)
zomboid_server |  Update state (0x5) verifying install, progress: 43.18 (2284625080 / 5290686332)

This takes about 10 minutes on a 4GB 4vCPU locally housed server.

@insuusvenerati
Copy link
Author

docker-compose.yml in case you need it

services:
  server:
    image: renegademaster/zomboid-dedicated-server:2.1.0
    container_name: zomboid_server
    ports:
      - 16261:16261/udp
      - 16262:16262/udp
      - 8766:8766/udp
      - 27015:27015
    volumes:
      - ./ZomboidConfig:/home/steam/Zomboid
      - ./ZomboidDedicatedServer:/home/steam/ZomboidDedicatedServer

environment: omitted because it's just passwords

@Renegade-Master
Copy link
Owner

And there is absolutely no chance that the files it downloaded are being deleted?

It only ever updates like that in two situations:

  • there are no files in the directory, so Steam downloads them. If the files are present (even copied from somewhere else) then Steam will recognise them and not redownload.
  • The files are detected, but there is an update for the game. In this case, only the update is downloaded.

Also, this concerns me
zomboid_server | Redirecting stderr to '/root/Steam/logs/stderr.txt'

Are you running this a a root user?

@insuusvenerati
Copy link
Author

And there is absolutely no chance that the files it downloaded are being deleted?

I doubled checked while restarting and there was no evidence any files from ZomboidDedicatedServer were deleted or modified.

drwxrwxr-x  4 stiforr stiforr 4096 Oct 29 21:36 .
drwxr-x--- 14 stiforr stiforr 4096 Oct 29 21:10 ..
-rw-rw-r--  1 stiforr stiforr  475 Nov  5 22:32 docker-compose.yml
drwxrwxr-x  8 stiforr stiforr 4096 Oct 29 21:24 ZomboidConfig
drwxrwxr-x  9 stiforr stiforr 4096 Nov  5 22:32 ZomboidDedicatedServer

Are you running this a a root user?

Docker runs as root by default and it doesn't appear that you've setup a non root user in the Dockerfile. This is indicated by the owner of the files in the folders themselves.

drwxrwxr-x  9 stiforr stiforr     4096 Nov  5 22:33 .
drwxrwxr-x  4 stiforr stiforr     4096 Oct 29 21:36 ..
drwxr-xr-x 11 root    root        4096 Oct 29 21:23 java
drwxr-xr-x  6 root    root        4096 Oct 29 21:23 jre64
-rwxr-xr-x  1 root    root        7856 Oct 29 21:16 libpzexe_jni64.so
drwxr-xr-x  2 root    root        4096 Oct 29 21:23 license
drwxr-xr-x  2 root    root        4096 Oct 29 21:23 linux64
drwxr-xr-x 30 root    root        4096 Oct 29 21:23 media
drwxr-xr-x  2 root    root        4096 Oct 29 21:23 natives
-rwxr-xr-x  1 root    root         972 Oct 29 21:16 ProjectZomboid32.json
-rwxr-xr-x  1 root    root       89984 Oct 29 21:16 ProjectZomboid64
-rwxr-xr-x  1 root    root         956 Nov  5 21:44 ProjectZomboid64.json
-rwxr-xr-x  1 root    root        2165 Oct 29 21:16 pzexe.jar
-rwxr-xr-x  1 root    root        4826 Oct 29 21:16 serialize.lua
-rwxr-xr-x  1 root    root        1127 Oct 29 21:16 start-server.sh
-rwxr-xr-x  1 root    root        3772 Oct 29 21:16 stdlib.lbc
-rwxr-xr-x  1 root    root        3162 Oct 29 21:16 stdlib.lua
-rwxr-xr-x  1 root    root           8 Oct 29 21:16 steam_appid.txt
drwxr-xr-x  4 root    root        4096 Nov  5 22:33 steamapps
-rwxr-xr-x  1 root    root    33151882 Oct 29 21:15 steamclient.so

Also, this concerns me
zomboid_server | Redirecting stderr to '/root/Steam/logs/stderr.txt'

I checked and that file appears to be empty.

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 5, 2022

Ah, they are all owned by root though.

Try to run the following:

sudo rm -rf ./Zomboid*

USER_ID=$(id -u)
GROUP_ID=$(id -g)

Then modify the docker-compose.yaml file to include those IDs:

version: "3.8"

services:
  zomboid-dedicated-server:
    build:
      context: .
      dockerfile: docker/zomboid-dedicated-server.Dockerfile
    image: "docker.io/renegademaster/zomboid-dedicated-server:latest"
    container_name: zomboid-dedicated-server
    restart: "no"
    user: "<user_id>:<group_id>"

and try again.

Then shut it down, and start it up again.

Do not use sudo when running anything to do with this server.
See #8 for similar issues. There are warnings in the README against running this as root.

@insuusvenerati
Copy link
Author

Was just working on that before you replied, however I get some interesting errors when running as non-root.

zomboid_server | 
zomboid_server | ### Setting variables...
zomboid_server | 
zomboid_server | ### Applying Pre Install Configuration...
zomboid_server | sed: couldn't open temporary file /home/steam/sedtgFmMT: Permission denied
zomboid_server | 
zomboid_server | ### Pre Install Configuration applied.
zomboid_server | 
zomboid_server | ### Updating Project Zomboid Server...
zomboid_server | /home/steam/run_server.sh: line 136: /usr/bin/steamcmd.sh: Permission denied
zomboid_server | 
zomboid_server | ### Project Zomboid Server updated.
zomboid_server | 
zomboid_server | ### Checking if this is the first run...
zomboid_server | 
zomboid_server | ### This is not the first run.
zomboid_server | 
zomboid_server | ### First run check complete.
zomboid_server | 
zomboid_server | ### Applying Post Install Configuration...
zomboid_server | 
zomboid_server | ### Post Install Configuration applied.
zomboid_server | 
zomboid_server | ### Starting Project Zomboid Server...

I've chown'd everything in ZombidConfig and ZomboidDedicatedServer.

@insuusvenerati
Copy link
Author

Also, I ran docker-compose down to remove the containers before I restarted this time.

@Renegade-Master
Copy link
Owner

You have to delete the folders now. They belong to root.

@insuusvenerati
Copy link
Author

I don't mean to argue but i'm not inexperienced with docker or linux. And this image is not rootless. There is no USER directive in either your zomboid image or the base image. I cloned the repo, ran the included docker-compose.yml without modifications, and got a shell into the container.

root@989c29e39a44:/home/steam# ls -la
total 40
drwxr-xr-x 1 root root 4096 Nov  5 23:02 .
drwxr-xr-x 1 root root 4096 Aug  8 23:12 ..
drwxr-xr-x 3 root root 4096 Aug  8 23:13 .steam
drwxrwxr-x 2 1000 1000 4096 Nov  5 23:02 Zomboid
drwxrwxr-x 3 1000 1000 4096 Nov  5 23:02 ZomboidDedicatedServer
-rwxrwxr-x 1 root root 3344 Nov  5 23:00 edit_server_config.py
-rw-rw-r-- 1 root root  655 Nov  5 23:02 install_server.scmd
-rwxrwxr-x 1 root root 7932 Nov  5 23:00 run_server.sh
root@989c29e39a44:/home/steam# id
uid=0(root) gid=0(root) groups=0(root)
root@989c29e39a44:/home/steam# 

@insuusvenerati
Copy link
Author

And if I try to run your cloned repo as user: 1000:1000 which is my host user

zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Setting variables...
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Applying Pre Install Configuration...
zomboid-dedicated-server  | sed: couldn't open temporary file /home/steam/sedGfNQPR: Permission denied
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Pre Install Configuration applied.
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Updating Project Zomboid Server...
zomboid-dedicated-server  | /home/steam/run_server.sh: line 136: /usr/bin/steamcmd.sh: Permission denied
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Project Zomboid Server updated.
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Checking if this is the first run...
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### This is the first run.
zomboid-dedicated-server  | Starting server for 60 seconds
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Starting Project Zomboid Server...
zomboid-dedicated-server  | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Project Zomboid Server stopped.
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### First run check complete.
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Applying Post Install Configuration...
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server  | sed: can't read /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json: No such file or directory
zomboid-dedicated-server  | sed: can't read /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json: No such file or directory
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Post Install Configuration applied.
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Starting Project Zomboid Server...
zomboid-dedicated-server  | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory
zomboid-dedicated-server  | 
zomboid-dedicated-server  | ### Project Zomboid Server stopped.
zomboid-dedicated-server exited with code 0

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 6, 2022

According to the README, your actions are supposed to be:

  1. Remove existing folder structure: sudo rm -rf ./Zomboid*
  2. Create the folders yourself before running anything: mkdir ./ZomboidConfig ZomboidDedicatedServer.
  3. Ensure that you configure the docker-compose.yaml to use your User and Group IDs.
  4. Launch the server: docker-compose up --detach && docker-compose logs --follow

Can you please confirm that following those steps results in the same issue?

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 6, 2022

This project previously included the user directive, but that proved to result in people having more issues.

If you really want to run it rootlessly, use Podman rather than Docker.

This image does what it can to facilitate running as any user, but running it as root specifically causes problems.

@insuusvenerati
Copy link
Author

I followed the instructions with a fresh clone of this repo. The following are the commands I ran in the order I ran them.

  │  ~/Developer/zomboid-test │  main  mkdir ./ZomboidConfig ZomboidDedicatedServer 
  │  ~/Developer/zomboid-test │  main  docker-compose up --detach && docker-compose logs --follow 
Creating network "zomboid-test_default" with the default driver
Building zomboid-dedicated-server
[+] Building 48.7s (9/9) FINISHED                                                                                                                                                                                                                               
 => [internal] load build definition from zomboid-dedicated-server.Dockerfile                                                                                                                                                                              0.1s
 => => transferring dockerfile: 2.07kB                                                                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                          0.1s
 => => transferring context: 67B                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/renegademaster/steamcmd-minimal:1.1.2                                                                                                                                                                           0.8s
 => [auth] renegademaster/steamcmd-minimal:pull token for registry-1.docker.io                                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                                          0.1s
 => => transferring context: 12.12kB                                                                                                                                                                                                                       0.0s
 => [1/3] FROM docker.io/renegademaster/steamcmd-minimal:1.1.2@sha256:e676647a36d74eb13b4560310a4519eb9f0f2b844ac69d2512fbb13b5fc576da                                                                                                                     3.0s
 => => resolve docker.io/renegademaster/steamcmd-minimal:1.1.2@sha256:e676647a36d74eb13b4560310a4519eb9f0f2b844ac69d2512fbb13b5fc576da                                                                                                                     0.0s
 => => sha256:e676647a36d74eb13b4560310a4519eb9f0f2b844ac69d2512fbb13b5fc576da 1.79kB / 1.79kB                                                                                                                                                             0.0s
 => => sha256:f0e2ce69b8f72ba1ddd0b9900feed19b4c6c45593b34f8b77411076ce148a9c3 4.38kB / 4.38kB                                                                                                                                                             0.0s
 => => sha256:415d72858c745ad20ae2769e6ba46966432d24b0cb79e2ebcb65280ce8248a31 27.35MB / 27.35MB                                                                                                                                                           0.8s
 => => sha256:1784251f054d4f8a9d31f8ef0527ef3f825e0caa6a616e1144e58edcebf481f7 2.56MB / 2.56MB                                                                                                                                                             0.4s
 => => sha256:01a98e76b3ce2816c8f4bb1b884b3675310904b545501f3598299f47bb84303c 115B / 115B                                                                                                                                                                 0.1s
 => => sha256:be7098c06d6c181b8f031577ec237a243815da99ac185e1233df37f60e9198cb 10.22MB / 10.22MB                                                                                                                                                           0.7s
 => => sha256:8b5875919f7123ad4a9a6be563dd199fe06c79137fe33b34bf4ade9d17a4f4c6 2.50MB / 2.50MB                                                                                                                                                             0.6s
 => => sha256:b7c1c595e24da02d52a98501eb4d54c22b76f6419342ab194e9d14159f05e838 722.90kB / 722.90kB                                                                                                                                                         0.8s
 => => extracting sha256:415d72858c745ad20ae2769e6ba46966432d24b0cb79e2ebcb65280ce8248a31                                                                                                                                                                  0.8s
 => => sha256:4375090f364a7cb7dd3b0ba0f7b71add3e4c3b13115cb15dd43da859949f606b 292B / 292B                                                                                                                                                                 0.9s
 => => extracting sha256:1784251f054d4f8a9d31f8ef0527ef3f825e0caa6a616e1144e58edcebf481f7                                                                                                                                                                  0.1s
 => => extracting sha256:01a98e76b3ce2816c8f4bb1b884b3675310904b545501f3598299f47bb84303c                                                                                                                                                                  0.0s
 => => extracting sha256:be7098c06d6c181b8f031577ec237a243815da99ac185e1233df37f60e9198cb                                                                                                                                                                  0.3s
 => => extracting sha256:8b5875919f7123ad4a9a6be563dd199fe06c79137fe33b34bf4ade9d17a4f4c6                                                                                                                                                                  0.1s
 => => extracting sha256:b7c1c595e24da02d52a98501eb4d54c22b76f6419342ab194e9d14159f05e838                                                                                                                                                                  0.1s
 => => extracting sha256:4375090f364a7cb7dd3b0ba0f7b71add3e4c3b13115cb15dd43da859949f606b                                                                                                                                                                  0.0s
 => [2/3] COPY src /home/steam/                                                                                                                                                                                                                           32.4s
 => [3/3] RUN apt-get update && apt-get install -y --no-install-recommends         python3-minimal     && apt-get autoremove -y     && rm -rf /var/lib/apt/lists/*                                                                                        12.0s
 => exporting to image                                                                                                                                                                                                                                     0.3s
 => => exporting layers                                                                                                                                                                                                                                    0.2s
 => => writing image sha256:4c0333c05c6940acadd705773b9e654af19ce5867d7732ae0cb0c6273e4ebf30                                                                                                                                                               0.0s
 => => naming to docker.io/renegademaster/zomboid-dedicated-server:latest                                                                                                                                                                                  0.0s
WARNING: Image for service zomboid-dedicated-server was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating zomboid-dedicated-server ... done
Attaching to zomboid-dedicated-server
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Setting variables...
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Applying Pre Install Configuration...
zomboid-dedicated-server    | sed: couldn't open temporary file /home/steam/sedTtHcAs: Permission denied
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Pre Install Configuration applied.
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Updating Project Zomboid Server...
zomboid-dedicated-server    | /home/steam/run_server.sh: line 136: /usr/bin/steamcmd.sh: Permission denied
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Project Zomboid Server updated.
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Checking if this is the first run...
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### This is the first run.
zomboid-dedicated-server    | Starting server for 60 seconds
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Starting Project Zomboid Server...
zomboid-dedicated-server    | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Project Zomboid Server stopped.
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### First run check complete.
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Applying Post Install Configuration...
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | /home/steam/Zomboid/Server/ZomboidServer.ini not found!
zomboid-dedicated-server    | sed: can't read /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json: No such file or directory
zomboid-dedicated-server    | sed: can't read /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json: No such file or directory
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Post Install Configuration applied.
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Starting Project Zomboid Server...
zomboid-dedicated-server    | timeout: failed to run command '/home/steam/ZomboidDedicatedServer/start-server.sh': No such file or directory
zomboid-dedicated-server    | 
zomboid-dedicated-server    | ### Project Zomboid Server stopped.
zomboid-dedicated-server exited with code 0

Here is the exact docker-compose.yml, only modified with user: 1000:1000

version: "3.8"

services:
  zomboid-dedicated-server:
    build:
      context: .
      dockerfile: docker/zomboid-dedicated-server.Dockerfile
    image: "docker.io/renegademaster/zomboid-dedicated-server:latest"
    container_name: zomboid-dedicated-server
    restart: "no"
    user: 1000:1000
    environment:
      - "ADMIN_PASSWORD=changeme"
      - "ADMIN_USERNAME=superuser"
      - "AUTOSAVE_INTERVAL=15"
      - "BIND_IP=0.0.0.0"
      - "DEFAULT_PORT=16261"
      - "GAME_VERSION=public"
      - "GC_CONFIG=ZGC"
      - "MAP_NAMES=Muldraugh, KY"
      - "MAX_PLAYERS=16"
      - "MAX_RAM=4096m"
      - "MOD_NAMES="
      - "MOD_WORKSHOP_IDS="
      - "PAUSE_ON_EMPTY=true"
      - "PUBLIC_SERVER=true"
      - "RCON_PASSWORD=changeme_rcon"
      - "RCON_PORT=27015"
      - "SERVER_NAME=ZomboidServer"
      - "SERVER_PASSWORD="
      - "STEAM_VAC=true"
      - "UDP_PORT=16262"
      - "USE_STEAM=true"
    ports:
      - target: 16261
        published: 16261
        protocol: udp
      - target: 16262
        published: 16262
        protocol: udp
      - target: 27015
        published: 27015
        protocol: tcp
    volumes:
      - ./ZomboidDedicatedServer:/home/steam/ZomboidDedicatedServer
      - ./ZomboidConfig:/home/steam/Zomboid/

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 6, 2022

Thank you for the log. I do appreciate the effort.

This is odd.

If you created the folder.
And you instructed the image to run as your user.
And you started the docker-compose binary also as your user.

Then you are doing everything right, and this is very strange.
You can check the GitHub Actions yourself. The image works with a given user, so I can only assume there is something special about your environment.

I'll try to run it fresh myself tomorrow on a VM, but I have to leave support for now. It's 00:20 🙂

@insuusvenerati
Copy link
Author

This project previously included the user directive, but that proved to result in people having more issues.

If you really want to run it rootlessly, use Podman rather than Docker.

This image does what it can to facilitate running as any user, but running it as root specifically causes problems.

I think you're confusing running docker "rootless" and running as a non root user in a container. They're different things and aren't interchangeable. The standard docker installation runs the docker engine as root which is fine in most instances. However running as root inside of a long running container is a security risk. I'm already working on fixing the non root user issue. Id gladly submit a PR if you'd like. Id be interested in the problems folks ran into running as non root.

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 6, 2022

Id be interested in the problems folks ran into running as non root.

They run into the same issue. "Permission denied" for anyone that attempts to run this as "root".

This image makes no mention of "users" anymore, in either this image, or the one it is based on. For the most part that works.

In my own deployments, I either:

  • include my own user in the docker group
  • or I change the permission on the /var/docker.sock (or /run/docker.sock) socket to be only usable by my user

I would be interested in seeing how you would improve this situation though. It would be really appreciated if you have suggestions. If I can make this truly "rootless", I believe it would make it more compatible with K8S deployments also (which has been an issue in the past).

@Renegade-Master Renegade-Master linked a pull request Nov 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants