Closed slnh312 closed 4 years ago
Like most container images, the ue4-runtime images do not include the sudo
command, because you can simply specify the user that RUN
directives will run their commands as in your Dockerfile, like so:
# Run the `apt-get` command as the root user
USER root
RUN apt-get install -y package1 package2 ...
# Run all subsequent commands as the ue4 user
USER ue4
That being said, you should only install Node.js in an image based on ue4-runtime if you actually need Node.js to run in the same container as a packaged Unreal Engine project. If your Node.js application can communicate with your packaged Unreal project over localhost
(as is the case with the signalling servers for Pixel Streaming) then you should use a separate container based on the official Node.js base image to run your Node application, and configure your containers to use the same networking namespace via an appropriate mechanism such as a Kubernetes pod or the --network
argument of the docker run
command.
Dear Adam,I have successfully installed Node.js in the container according to your suggestion, but an error is reported during the running. I know that you want to run Node.js because user ue4 does not have the permission to access port 80. Is there any other method for me to successfully run Node.js in the container?
As I stated in the issue on the ue4-runtime repository, I would strongly recommend running Node.js in a separate container, which will allow it to run as the root user.
If you absolutely must run it in the same container as the Pixel Streaming application then you'll need to enable sudo
support so that you can run Node.js with root privileges, thus allowing access to port 80. You can enable sudo
support by adding the following lines to your Dockerfile:
# Run the subsequent commands as the root user
USER root
# Install sudo
RUN apt-get update \
&& apt-get install -y sudo \
&& rm -rf /var/lib/apt/lists/*
# Allow the ue4 user to use sudo without a password
RUN passwd -d ue4 && usermod -aG sudo ue4
# Reset the default user to ue4
USER ue4
Dear Adam,
I added the preceding command to the Dockerfile as you suggested. The root permission can be used by running the sudo command as user ue4. However, a new problem occurs. When the container exits and then re-enters, the system prompts you to enter the password of user ue4 when you run the command for the second time.
The following figure shows the command output after I exit the container and then restart it. The command output prompts me to enter the password of user ue4.
ue4@ue4-docker:~/project/Engine/Source/Programs/PixelStreaming/WebServers/SignallingWebServer$ sudo node cirrus.js
[sudo] password for ue4:
That's strange, if you added the commands from my previous comment to your Dockerfile then the ue4
user shouldn't have a password and therefore it should never prompt for one, no matter how many times you run sudo
. In any case, the correct solution is to use two separate containers, which ensures all processes are running as the correct users under all circumstances. If you're unsure of how to achieve this then I'd recommend taking a look at some of the many available online learning resources that discuss setting up multi-container applications.
Thank you,Adam Thank you for your patience. I have reviewed the architecture and implementation method. Currently, the WebRTC, WebServer, and UE4 main programs are deployed in different containers in distributed mode. Currently, pixel streaming in the container has been successfully implemented.. BTW,Whether the GPU of the AMD is supported? Is there a sign for Vulkan?
The implementation of Pixel Streaming for Linux in Unreal Engine 4.23 only supports OpenGL rendering using NVIDIA GPUs. Support for Vulkan is planned for the 4.24 release, and support for AMD GPUs may be investigated at some point in the future.
adamrehn,I want to install the npm and nodejs in container,the following is my Dockerfile: `....... FROM adamrehn/ue4-runtime:virtualgl COPY --from=builder --chown=ue4:ue4 /tmp/project/zyrProj01/dist/LinuxNoEditor /home/ue4/project
ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},video
RUN sudo apt-get install -y npm RUN sudo apt-get install -y nodejs RUN ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 /home/ue4/project/zyrProj01/Binaries/Linux/libnvidia-encode.so.1`
but when I build with the Dockerfile,The following error information is displayed:![image](https://user-images.githubusercontent.com/52794487/76853190-cbf62000-6887-11ea-975f-fbdfb02de876.png)
What am I supposed to do?