NICE DCV ON DOCKER STUCK ON LOADING SCREEN AFTER DCV AUTH SCREEN

0

So i am trying to run my nice dcv on my Docker container in Amazon Linux 2 (EC2 instance), for some reason, Enter image description here

i am suck in this loading screen, here is the cloud formation i used to set this up:

AWSTemplateFormatVersion: '2010-09-09'
Description: Template to launch an EC2 instance with Docker and NICE DCV installed in a Docker container on Amazon Linux 2 with GPU support

Resources:
  MyEC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      InstanceType: g4dn.xlarge
      KeyName: elliot_test_intraverse
      ImageId: ami-0c3fa0f6751fc1c11
      SecurityGroupIds:
        - !Ref InstanceSecurityGroup
      SubnetId: subnet-0797f66d802250dcb
      BlockDeviceMappings:
        - DeviceName: /dev/xvda
          Ebs:
            VolumeSize: 100
            VolumeType: gp3
      UserData:
        Fn::Base64: |
          #!/bin/bash
          set -ex

          # Enable logging
          exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1

          # Update the system
          yum update -y

          # Disable and uninstall NICE DCV if it's installed on the EC2 instance
          if systemctl is-active --quiet dcvserver; then
            systemctl stop dcvserver
            systemctl disable dcvserver
          fi
          yum remove -y nice-dcv-server nice-xdcv nice-dcv-web-viewer nice-dcv-gl || true

          # Install Docker
          amazon-linux-extras install docker -y
          systemctl start docker
          systemctl enable docker
          usermod -aG docker ec2-user

          # Install NVIDIA Container Toolkit
          distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
          curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
          yum clean expire-cache
          yum install -y nvidia-container-toolkit
          systemctl restart docker

          # Configure Docker to use NVIDIA runtime
          mkdir -p /etc/docker
          echo '{
              "runtimes": {
                  "nvidia": {
                      "path": "nvidia-container-runtime",
                      "runtimeArgs": []
                  }
              },
              "default-runtime": "nvidia"
          }' | tee /etc/docker/daemon.json
          systemctl restart docker

          # Create a directory for the DCV setup
          mkdir -p /home/ec2-user/dcv-docker
          cd /home/ec2-user/dcv-docker

          # Create Dockerfile
          cat <<'EOF' > Dockerfile
          FROM amazonlinux:2

          ENV container docker
          ENV NVIDIA_VISIBLE_DEVICES all
          ENV NVIDIA_DRIVER_CAPABILITIES all

          RUN yum update -y && \
              yum install -y tar vim wget kmod pciutils ca-certificates \
                             mesa-libGL libGLU libXv libXi libXext \
                             xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps \
                             mesa-dri-drivers dbus gnome-session gnome-terminal \
                             gdm systemd net-tools

          # Download and install NVIDIA Driver
          RUN wget -q https://us.download.nvidia.com/tesla/535.54.03/NVIDIA-Linux-x86_64-535.54.03.run -O /tmp/NVIDIA-installer.run && \
              bash /tmp/NVIDIA-installer.run --accept-license \
              --install-libglvnd \
              --no-questions --no-kernel-module-source \
              --no-nvidia-modprobe --no-kernel-module \
              --disable-nouveau \
              --no-backup \
              --ui=none && \
              rm -f /tmp/NVIDIA-installer.run && \
              nvidia-xconfig --preserve-busid --enable-all-gpus --connected-monitor=DFP-0,DFP-1,DFP-2,DFP-3

          # Install NICE DCV
          RUN rpm --import https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY && \
              wget https://d1uj6qtbmh3dt5.cloudfront.net/2023.0/Servers/nice-dcv-2023.0-14852-el7-x86_64.tgz && \
              tar -xvzf nice-dcv-2023.0-14852-el7-x86_64.tgz && \
              cd nice-dcv-2023.0-14852-el7-x86_64 && \
              yum install -y ./nice-dcv-server-2023.0.14852-1.el7.x86_64.rpm \
                             ./nice-dcv-web-viewer-2023.0.14852-1.el7.x86_64.rpm \
                             ./nice-xdcv-2023.0.534-1.el7.x86_64.rpm \
                             ./nice-dcv-gl-2023.0.1103-1.el7.x86_64.rpm && \
              cd .. && rm -rf nice-dcv-2023.0-14852-el7-x86_64*

          RUN mkdir -p /var/log/dcv /var/lib/dcv /run/dbus && \
              dbus-uuidgen > /etc/machine-id

          COPY startup_script.sh /usr/local/bin/
          RUN chmod +x /usr/local/bin/startup_script.sh

          EXPOSE 8443

          CMD ["/usr/sbin/init"]
          EOF

          # Create startup_script.sh
          cat <<'EOF' > startup_script.sh
          #!/bin/bash
          set -e

          # Create a user for the DCV session
          useradd -m dcvuser
          echo "dcvuser:dcvpassword" | chpasswd

          # Enable and start DCV server
          systemctl enable dcvserver
          systemctl start dcvserver

          # Wait for DCV server to start
          sleep 10

          # Start a DCV session
          dcv create-session --type=virtual --owner dcvuser --name=LinuxDesktop dcvuser

          echo "DCV session created successfully"

          # Keep the container running
          tail -f /dev/null
          EOF

          # Make startup_script.sh executable
          chmod +x startup_script.sh

          # Build the Docker image
          docker build -t nice-dcv .

          # Run the Docker container with necessary privileges and device access
          docker run -d --name nice-dcv \
            --gpus all \
            --privileged \
            --rm \
            --network=host \
            -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
            -v /tmp/.X11-unix:/tmp/.X11-unix \
            -e DISPLAY=:0 \
            -e NVIDIA_VISIBLE_DEVICES=all \
            -e NVIDIA_DRIVER_CAPABILITIES=all \
            --device /dev/nvidia0:/dev/nvidia0 \
            --device /dev/nvidiactl:/dev/nvidiactl \
            --device /dev/nvidia-modeset:/dev/nvidia-modeset \
            --device /dev/nvidia-uvm:/dev/nvidia-uvm \
            --device /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools \
            nice-dcv

          # Execute commands inside the Docker container
          docker exec nice-dcv bash -c "
          sed -i '/^#*authentication/c\authentication = \"none\"' /etc/dcv/dcv.conf && \
          sed -i '/^\[connectivity\]/a enable-quic-frontend=true' /etc/dcv/dcv.conf && \
          sed -i 's/^#*web-port.*/web-port=8443/' /etc/dcv/dcv.conf && \
          sed -i 's/^#*quic-port.*/quic-port=8443/' /etc/dcv/dcv.conf && \
          sed -i '/^\[session-management\]/a create-session = true' /etc/dcv/dcv.conf && \
          sed -i '/^\[session-management\/automatic-console-session\]/a owner = \"dcvuser\"' /etc/dcv/dcv.conf && \
          sed -i '/^\[session-management\/automatic-console-session\]/a storage-root = \"%home%/session-storage\"' /etc/dcv/dcv.conf && \
          systemctl enable dcvserver && \
          systemctl start dcvserver && \
          yum -y install glx-utils mesa-dri-drivers xorg-x11-server-Xorg \
                   xorg-x11-utils xorg-x11-xauth xorg-x11-xinit  \
                   xorg*fonts* xterm libXvMC mesa-libxatracker freeglut \
                   gnome-desktop3 gnome-terminal  \
                   gnome-system-monitor nautilus evince gnome-color-manager \
                   gnome-font-viewer gnome-shell gnome-calculator gedit gdm \
                   metacity gnome-session gnome-classic-session \
                   gnome-session-xsession gnu-free-fonts-common \
                   gnu-free-mono-fonts gnu-free-sans-fonts \
                   gnu-free-serif-fonts \
                   xvattr gnome-system-log desktop-backgrounds-gnome \
                   mesa-libGLU
          systemctl get-default && \
          systemctl set-default graphical.target && \
          systemctl isolate graphical.target && \
          ps aux | grep X | grep -v grep && \
          yum install -y glx-utils && \
          DISPLAY=:0 XAUTHORITY=$(ps aux | grep \"X.*\-auth\" | grep -v grep | sed -n 's/.*-auth \([^ ]\+\).*/\1/p') glxinfo | grep -i \"opengl.*version\""
          systemctl restart dcvserver

          # Ensure the Docker container starts on reboot
          cat <<'EOF' > /etc/systemd/system/docker-nice-dcv.service
          [Unit]
          Description=NICE DCV Docker Container
          Requires=docker.service
          After=docker.service

          [Service]
          Restart=always
          ExecStart=/usr/bin/docker start -a nice-dcv
          ExecStop=/usr/bin/docker stop -t 2 nice-dcv

          [Install]
          WantedBy=multi-user.target
          EOF

          systemctl enable docker-nice-dcv.service
          systemctl start docker-nice-dcv.service

          # Change ownership of the dcv-docker directory to ec2-user
          chown -R ec2-user:ec2-user /home/ec2-user/dcv-docker

          echo "Setup completed successfully. NICE DCV in Docker is accessible on port 8443"

  InstanceSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Enable SSH and NICE DCV access
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 22
          ToPort: 22
          CidrIp: 0.0.0.0/0
        - IpProtocol: tcp
          FromPort: 8443
          ToPort: 8443
          CidrIp: 0.0.0.0/0
        - IpProtocol: udp
          FromPort: 8443
          ToPort: 8443
          CidrIp: 0.0.0.0/0
      VpcId: vpc-029e472c307a72d22

Outputs:
  InstanceId:
    Description: The instance ID of the EC2 instance
    Value: !Ref MyEC2Instance
  PublicDNS:
    Description: Public DNS of the EC2 instance
    Value: !GetAtt MyEC2Instance.PublicDnsName

i do not know what i am missing here in the set up to make it show up the desktop

Elliot
asked 2 months ago134 views
1 Answer
0

The issue you are facing with the NICE DCV server stuck on the loading screen after the DCV authentication screen could be related to the DCV server not starting correctly or having some configuration issues.

You should check the DCV server logs for any error messages or clues, review the DCV configuration file and ensure the settings are correct, verify that the X server is running correctly inside the Docker container, double-check that the Docker container is running with the correct environment variables and device mappings, try creating a DCV session manually instead of relying on automatic console session creation, ensure that the EC2 instance can resolve DNS names correctly, increase the verbosity of the DCV server logs, consider trying an alternative DCV version, and if the issue persists, reach out to NICE support for further assistance.

profile picture
EXPERT
answered 2 months ago
  • Yes, you're right, The issue was the Display-Manager, it would keep loading until it is actually set up correctly

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions