archieprakash avatar image
archieprakash asked

StartGameCommand of MultiplayerSettings in Linux Docker Container causes BadRequest


After following the Unreal Setup of a Linux dedicated server documentation I was able to get the docker container running on the LocalMultiplyerAgent. But when I try to use the "StartGameCommand" in the MultiplayerSettings.json it errors out with a "code=BadRequest".

When I set the StartCommand as just a launch script

 "StartGameCommand": "./",

I get the error of "the working directory '.' is invalid, it needs to be an absolute path"

When I set the StartCommand to use a full CMD

 "StartGameCommand": "chown -R ue.ue $PF_SERVER_LOG_DIRECTORY && su ue -c ./",

I get the error of "failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: \"cmd /c chown -R ue.ue $PF_SERVER_LOG_DIRECTORY && su ue -c ./\": stat cmd /c chown -R ue.ue $PF_SERVER_LOG_DIRECTORY && su ue -c ./ no such file or directory: unknown"

What am I doing wrong, how can I call a script in the root of the server that will override the default Docker behavior? I have got it to work on the Windows side and don't see any examples around that is similar.

For reference, this is my Server root directory. 6341-image.png

And for the DockerFile is

 FROM ubuntu:18.04
 # Unreal refuses to run as root user, so we must create a user to run as
 # Docker uses root by default
 RUN useradd --system ue
 USER ue
 EXPOSE 7777/udp
 WORKDIR /server
 COPY --chown=ue:ue . /server
 USER root
 CMD chown -R ue.ue $PF_SERVER_LOG_DIRECTORY && su ue -c ./
Custom Game Servers
image.png (29.8 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Infer Wang avatar image
Infer Wang answered

For Linux container, you don’t need to set start command in the MultiplayerSettings.json, you can put it in the Dockerfile. You may find more information and examples on how to use PlayFab Multiplayer here.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

archieprakash avatar image archieprakash commented ·

For my setup, I do need to override the startup command based on what experience I want to load

You can kick off a build with just the docker file, but that just gives me one type of configuration. I need to have the ability to launch a different script to load different maps and experiences. Like one map is my deathmatch, other is capture the flag, and another is battle royal.

That is done by setting flags with a start script for each type of mode. EG:,,

I am currently doing this with a Windows build and all works fine with the StartGameCommand override.

If I can't override the docker start then I have to make a different build for each type of experience I want to. Is that what I would have to do? Is the Start Command is not supported by the LocalMultiplyerAgent or the GameManager backend for Linux Containers?

0 Likes 0 ·
archieprakash avatar image archieprakash archieprakash commented ·


0 Likes 0 ·
Infer Wang avatar image Infer Wang archieprakash commented ·

Unfortunately, I don’t have Linux device to test it. You may try to add Linux-style commands. For example, “StartGameCommand”: “/bin/bash -c ‘chown -R ue.ue $PF_SERVER_LOG_DIRECTORY && su ue -c /’”. If it still returns error, I recommend you try to implement start script for each type of mode in your client code instead of using StartCommand.

0 Likes 0 ·

This would not serve what I am trying to do, I specifically need to be able to override the start to launch a type of experience and map. Like, load the server to Deathmatch or load to Capture The Flag, or load to BattleRoyal on start.

I have different scripts in the root that can get called that will launch the type of experience I want. I am able to do this with the Windows server builds and use the Start command to set the script I want to load my experience. Is it possible to use the override Start command on the Linux container when creating a server on the GameManager side?

0 Likes 0 ·

Got it to work! On the GameManager side I was able to override the StartCommand with "./" For the .sh script self #!/bin/sh chown -R ue.ue $PF_SERVER_LOG_DIRECTORY su ue -c "./ -messaging -log -sessionexperience=DA_MapSession01" Also running these scripts the same way with StartGameCommand in MultiplayerSettings.json don't. From my understanding, this feature is broken in Linux containers running on the LocalMultiplayerAgent and still is as of today. Finally think got the Linux container override to work. It would be great to have some documentation on examples of using the StartGameCommand and SessionCookies. The basic way of setting up servers in the documentation is great but it doesn't scale for a real product. :pray::skin-tone-5:

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.