Cannot execute ue4 run in container

Hello everyone,

I am trying to build my container using the ue4-docker image and I want to run the Editor of the Unreal project using ue4 run
My Dockerfile looks like below:

FROM adamrehn/ue4-full:custom AS builder

COPY --chown=ue4:ue4 . /tmp/project

WORKDIR /tmp/project
RUN ue4 build
RUN ue4 run

And the image build always fail at ue4 run command with the following error messages:
Info: I have already tried locally executing .uproject file and it can open the unreal editior. I would like to know why I cannot do it in the docker container.

#0 7.717 [2023.06.25-22.02.03:871][  0]LogInit: Initializing SDL.
#0 7.720 error: XDG_RUNTIME_DIR not set in the environment.
#0 7.720 [2023.06.25-22.02.03:871][  0]LogInit: Initializing SDL.
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit:  - Physical RAM available (not considering process quota): 16 GB (15958 MB, 16341272 KB, 16733462528 bytes)
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit:  - Physical RAM available (not considering process quota): 16 GB (15958 MB, 16341272 KB, 16733462528 bytes)
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit:  - VirtualMemoryAllocator pools will grow at scale 1.4
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit:  - VirtualMemoryAllocator pools will grow at scale 1.4
#0 7.720 [2023.06.25-22.02.03:874][  0]LogInit:  - MemoryRangeDecommit() will be a no-op (re-run with -vmapoolevict to change)
#0 7.734 [2023.06.25-22.02.03:874][  0]LogInit:  - MemoryRangeDecommit() will be a no-op (re-run with -vmapoolevict to change)
#0 7.734 [2023.06.25-22.02.03:887][  0]LogInit: Physics initialised using underlying interface: PhysX
#0 7.750 [2023.06.25-22.02.03:887][  0]LogInit: Physics initialised using underlying interface: PhysX
#0 7.750 [2023.06.25-22.02.03:904][  0]LogInit: Using OS detected language (en-US-POSIX).
#0 7.750 [2023.06.25-22.02.03:904][  0]LogInit: Using OS detected language (en-US-POSIX).
#0 7.750 [2023.06.25-22.02.03:904][  0]LogInit: Using OS detected locale (en-US-POSIX).
#0 7.751 [2023.06.25-22.02.03:904][  0]LogInit: Using OS detected locale (en-US-POSIX).
#0 7.751 [2023.06.25-22.02.03:905][  0]LogTextLocalizationManager: No specific localization for 'en-US-POSIX' exists, so the 'en' localization will be used.
#0 7.854 [2023.06.25-22.02.03:905][  0]LogTextLocalizationManager: No specific localization for 'en-US-POSIX' exists, so the 'en' localization will be used.
#0 7.854 [2023.06.25-22.02.04:008][  0]LogInit: Initializing SDL.
#0 7.857 error: XDG_RUNTIME_DIR not set in the environment.
#0 7.857 [2023.06.25-22.02.04:008][  0]LogInit: Initializing SDL.
#0 7.857 [2023.06.25-22.02.04:011][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.857 [2023.06.25-22.02.04:011][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.857 [2023.06.25-22.02.04:011][  0]LogInit: Warning: FLinuxSplashState::InitSplashResources() : InitSDL() failed, there will be no splash.
#0 7.857 [2023.06.25-22.02.04:011][  0]LogInit: Warning: FLinuxSplashState::InitSplashResources() : InitSDL() failed, there will be no splash.
#0 7.857 [2023.06.25-22.02.04:011][  0]LogInit: Initializing SDL.
#0 7.859 error: XDG_RUNTIME_DIR not set in the environment.
#0 7.860 [2023.06.25-22.02.04:011][  0]LogInit: Initializing SDL.
#0 7.860 [2023.06.25-22.02.04:013][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.860 [2023.06.25-22.02.04:013][  0]LogInit: Warning: Could not initialize SDL: No available video device
#0 7.860 [2023.06.25-22.02.04:013][  0]LogInit: Error: FLinuxApplication::CreateLinuxApplication() : InitSDL() failed, cannot create application instance.
#0 7.860 [2023.06.25-22.02.04:013][  0]LogInit: Error: FLinuxApplication::CreateLinuxApplication() : InitSDL() failed, cannot create application instance.
#0 7.860 [2023.06.25-22.02.04:013][  0]LogCore: FUnixPlatformMisc::RequestExit(bForce=true, ReturnCode=1)
#0 7.860 [2023.06.25-22.02.04:013][  0]LogCore: FUnixPlatformMisc::RequestExit(bForce=true, ReturnCode=1)
#0 7.860 [2023.06.25-22.02.04:013][  0]LogCore: FUnixPlatformMisc::RequestExit(1)
#0 7.955 Using user-specified engine root: /home/ue4/UnrealEngine
#0 7.957 Traceback (most recent call last):
#0 7.957   File "/usr/local/bin/ue4", line 8, in <module>
#0 7.957     sys.exit(main())
#0 7.957   File "/usr/local/lib/python3.6/dist-packages/ue4cli/cli.py", line 222, in main
#0 7.957     SUPPORTED_COMMANDS[command]['action'](manager, args)
#0 7.957   File "/usr/local/lib/python3.6/dist-packages/ue4cli/cli.py", line 63, in <lambda>
#0 7.957     list([arg for arg in args if arg != '--debug'])
#0 7.957   File "/usr/local/lib/python3.6/dist-packages/ue4cli/UnrealManagerBase.py", line 377, in runEditor
#0 7.957     Utility.run([self.getEditorBinary(True), projectFile] + extraFlags + ['-stdout', '-FullStdOutLogOutput'], raiseOnError=True)
#0 7.957   File "/usr/local/lib/python3.6/dist-packages/ue4cli/Utility.py", line 145, in run
#0 7.957     raise Exception('child process ' + str(command) + ' failed with exit code ' + str(returncode))
#0 7.957 Exception: child process ['/home/ue4/UnrealEngine/Engine/Binaries/Linux/UE4Editor', '/tmp/project/syndab_sim.uproject', '-stdout', '-FullStdOutLogOutput'] failed with exit code 1      
------
Dockerfile:7
--------------------
   5 |     WORKDIR /tmp/project
   6 |     RUN ue4 build
   7 | >>> RUN ue4 run
   8 |
   9 |     FROM adamrehn/ue4-runtime:latest
--------------------
ERROR: failed to solve: process "/bin/sh -c ue4 run" did not complete successfully: exit code: 1

I also tried this: build the container image without RUN ue4 run in Dockerfile. And after successfully built the image and run the container, I tried to run ue4 run in the container and got the same error message.

Could someone help please? It is a rather urgent problem. Thanks a lot for your help in advance!

how reset train sim world 3 please
LoginId:fa29cc134aa2c7eef7ca9b8a1071bb52
EpicAccountId:

I encountered something similar, building UE511 from source:
For me, doing this worked:
XDG_RUNTIME_DIR=/tmp ./Setup.sh – as I was trying to run the initial setup inside a chroot.

FWIW - I spent a lot of time trying to get Docker building going, and it became so slow to trigger the build and wait for it to pull the project – that I went to an ‘old school’ chroot, so it just has to do a quick update and Intermediate/Binaries folder delete and then it can compile the docker image faster. YMMV of course.