Cannot execute `ue4 run` while building docker image
tongwenbo opened this issue · 4 comments
Hello, 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
Could someone help please? It is a rather urgent problem. Thanks a lot for your help in advance!
The Docker container you're running in has no video device for SDL to use, per the warnings and errors after "Initializing SDL".
I don't think you can provide a video device to a container build process, they're generally not interactive processes, and are ideally idempotent. (Actually, you probably can under specific circumstances, but even then, you won't see the output.
The normal approach would be to build the container image up to ue4 build
and then run an instance of the container and ue4 run
in that, but I guess it depends what you're trying to do.
If you can script the actions you wanted to use with the editor, and they don't need a GPU, you might be able to use the null video device and that will work inside a container, I think.
The Docker container you're running in has no video device for SDL to use, per the warnings and errors after "Initializing SDL".
I don't think you can provide a video device to a container build process, they're generally not interactive processes, and are ideally idempotent. (Actually, you probably can under specific circumstances, but even then, you won't see the output.
The normal approach would be to build the container image up to
ue4 build
and then run an instance of the container andue4 run
in that, but I guess it depends what you're trying to do.If you can script the actions you wanted to use with the editor, and they don't need a GPU, you might be able to use the null video device and that will work inside a container, I think.
Hello, Thanks a lot for your reply!
I want to run the Editor for the Unreal project from the container. I tried to build the container image with just ue4 build
, it runs successfully and built a container image. After that I run the container and go inside this container and execute ue4 run
. However it shows the same error as I posted. I have checked the files in the container, it has the Editor under '/home/ue4/UnrealEngine/Engine/Binaries/Linux/UE4Editor' and the .uproject file under '/tmp/project/Vs.uproject'. I am not sure why I cannot run ue4 run
to open the Editor.
Thanks again for your time and help!
If it's the same error, then it's the same problem; there's no display output available inside the container. However, in a running container (rather than a container image build) we can do something about that.
See https://unrealcontainers.com/docs/use-cases/linux-sandboxed-editor which is roughly what you're trying to do, as far as I can tell. That covers the requirements you'll need to meet, including how you build the container, so you might need to go back and change how you did that if it's not suitable.
Closing this issue, since running interactive processes during the container build process is not supported, and the relevant documentation has been provided for running the Editor interactively once the container image has already been built.