RD Docker: Docker Support Remote Desktop Protocols

支持多种远程桌面协议连接带有桌面环境的Docker镜像

LingmoOS.webp

RDPDocker是一个带有X11个和桌面环境的Docker镜像构建和容器创建工具,支持创建Ubuntu、Debian、Arch Linux、Fedora(未来可能添加)系统,支持Lingmo、GNOME、Xfce4、X11(无桌面)、SSH(无图形化)等环境。同时,允许用户通过NoMachine、RDP(尚未支持)、VNC(尚未支持)、SSH等方式远程访问容器。本工具以非虚拟化和极低开销的情况下,实现了多用户共享一台主机的办法,同时创建极快,随用随开,并且只占用内存、磁盘极少的空间,只需要主机安装Docker即可,支持无桌面的Linux服务器、WSL2、LXC、安卓手机运行(通过容器或者chroot)。

RDPDocker is a Docker image building and container creation tool with X11 and desktop environments, supporting the creation of Ubuntu, Debian, Arch Linux, Fedora (possibly added in the future) systems, Lingmo, GNOME, Xfce4, X11 (no desktop), SSH (no graphics) and other environments. Meanwhile, users are allowed to remotely access the container through methods such as NoMachine, RDP (not yet supported), VNC (not yet supported), SSH, etc. This tool enables multiple users to share a host without virtualization and at extremely low cost. It is also very fast to create, can be used and opened at any time, and only occupies minimal memory and disk space. Docker only needs to be installed on the host. Supports running on headless Linux servers desktop, WSL2, LXC, and Android phones (via containers or chroot).

Images / 镜像概览

Intros / 镜像介绍

#Desktop EnvIntroductionUbuntuDebianArchFedora
1Server无GUI和桌面,仅用于SSH远程连接<br/>No GUI and DE, only used for SSH??
2Lingmo一个拥有高效和优美UI的桌面 <br/>Lingmo is a DE with efficient and beautiful UI?√*??
3GNOMELinux常用图形的桌面环境<br/>A DE for commonly used graphics on Linux??
4Xfce4一个非常轻量的桌面环境<br/>A lightweight DE for UNIX-like OS.??
0X11X11桌面基础环境(构建专用)
X11 Desktop Basic Environment<br/>(For build other DE image only)
??

?:表示还未支持,但后续可能支持 Not yet supported, but may be supported in the future

Ubuntu 支持情况

System Version / 系统版本ServerLingmoGNOMEXfce 4Deepin DEIce WMX11 GUI
24.04×××
22.04×××
20.04×××

Debian 支持情况

System Version / 系统版本ServerLingmoGNOMEXfce 4Deepin DEIce WMX11 GUI
13××
12×××
11×××

ArchOS 支持情况

System Version / 系统版本ServerLingmoGNOMEXfce 4Deepin DEIce WMX11 GUI
Latest×*××

*:目前支持CuteFish DE,Lingmo DE暂未支持,使用[9]来构建和启动CuteFish DE。Now support CuteFish DE instead of Lingmo DE, Use [9] to create or build docker with CuteFish DE.

Fedora 支持情况

System Version / 系统版本ServerLingmoGNOMEXfce 4Deepin DEIce WMX11 GUI
40×××

Usages 使用方法

Clone Git 克隆镜像

git clone https://github.com/PIKACHUIM/RDDocker.git
cd X11Docker && chmod +x ./Manager.sh && bash  ./Manager.sh

Run OCIs 运行容器

  • 您将看到这个界面(You will see this interface):
  • 输入n然后回车进入创建菜单(Enter n and press enter to enter the create menu)

       ┌──────────────────────────────────────────────────────────────────────┐
       │          Pikachu Docker Image Build and Container Setup Tool         │
       │                     Last Updated MAR 31 / 2023                       │
       │            Copyright © 2023 Pikachu, All Rights Reserved             │
       └──────────────────────────────────────────────────────────────────────┘
    
       ==================================Menu==================================
       --------------------------- Container Manage ---------------------------
              [n] [Created] Create a new docker container from an image
              [l] [Display] Display all docker containers in the system
              [s] [Started] Start your docker container already created
              [t] [Pausing] Pause your docker container already running
       -NOTE- [r] [Restart] Restart your docker container which ctarted
       *WARN* [K] [Killall] Stop your docker container which is running
       *WARN* [D] [Deleted] Select and delete your docker container now
       ----------------------------- Image Manage -----------------------------
       -NOTE- [b] [ Build ] Build your docker image from the DockerFile
       *WARN* [C] [ Clean ] Clean all unuse images and untag image file
       *WARN* [P] [ Prune ] Prune system(all unuse images & containers)
       ------------------------------------------------------------------------
              [q] [ Exit~ ] Do nothing, just exit this script! Byebye~~
       ========================================================================
    
       Choose Operation Type Number(*): 
  • 输入数字选择容器操作系统(Enter numbers to select container operating system)

       ============================Available System============================
       [1]Ubuntu [√ Server /√ CuteOS /√ KDE /√ GNOME /√ DDE /√ OpenBox /√ xfce]
       [2]Debian [√ Server /√ CuteOS /√ KDE /√ GNOME /√ DDE /× OpenBox /× xfce]
       [3]ArchOS [√ Server /√ CuteOS /× KDE /× GNOME /× DDE /× OpenBox /× xfce]
       ========================================================================
    
       Choose Platforms Type Number(1): 
  • 输入数字选择操作系统版本(Enter the number to select the operating system version)

       ============================Available Version===========================
          [1] 24.04 Jammy Jellyfish  [ √ Now Recommend / Support Until 2029 ]  
          [2] 22.04 Jammy Jellyfish  [ √ Now Recommend / Support Until 2027 ]  
          [3] 20.04 Focal Fossa      [ × Not Recommend / Support Until 2025 ]  
       ========================================================================
    
       Choice System Version Number(1): 
  • 输入数字选择桌面环境系统(Enter numbers to select desktop environment system)

       ============================Available Desktop===========================
          [1] Servers NoGraphic  [ √ SSH / × GUI APPs / × NoMachine / × VNC ]  
          [2] Desktop Lingmo DE  [ √ SSH / √ GUI APPs / √ NoMachine / √ VNC ]  
          [3] Desktop Gnome GUI  [ √ SSH / √ GUI APPs / √ NoMachine / √ VNC ]  
          [4] Desktop Xfce4 GUI  [ √ SSH / √ GUI APPs / √ NoMachine / √ VNC ]  
          [0] X11 GUI Basic ENV  [ √ SSH / √ GUI APPs / √ NoMachine / √ VNC ]  
       ========================================================================
    
       Choose GUI Environments Type(1): 
    
  • 选择是否使用宿主机的显卡(Choose whether to use the graphics card of the host computer)
  • 注意:必须是英伟达独立显卡才可以使用(Attention: It must be an NVIDIA discrete graphics card)

       =============================Graphics Cards=============================
          [A] All Graphics Cards [Using All Graphics of Current Local Syatem]  
          [N] Disabled All Cards [Don't Use Graphics of Current Local Syatem]  
       ========================================================================
       Choose Graphics Cards Enable(N): 
    
  • 输入唯一的两位数ID(比如01) (Enter a unique two digit ID to distinguish like 01)
  • 映射端口,格式为主机端口:容器端口,不需要或者完成映射,直接输入q即可退出
  • Map ports in the format of host port: container port, enter q to exit port map.

       ===========================Config Port Mapping==========================
       Enter Docker ID(Length=2 Like 01): 01
       ===========================Configure Port Map===========================
       Note: !!!Enter 'q' to Finish Port Mapping Input!!!
       Enter Port Mapping(host_port:oci_port): q
  • 确认信息,输入y确认创建 (Confirm information, enter y to confirm creation)

       ===========================Container Info===============================
       Port Mapping: 
             10101-10121:10101-10121 
             10123-10139:10123-10139 
             10142-10199:10142-10199
       SSHD Porting: 10122
       NXD Services: 10140
       Docker  Name: **************
       System  Name: ubuntu
       System  Vers: 24.04
       Desktop Type: server
       ========================================================================
       Confirm to create the container? (y/n): 
  • 创建完成后会输出容器访问信息:

    ──────────────────────────────────────────────────────────────────────
    Congratulations! Your Docker Container has been Created Successfully! 
    ----------------------------------------------------------------------
                     Container *******************                    
                     OSSystem: ubuntu 24.04            
    ----------------------------------------------------------------------
                     NXServer: *******************   
                     IPV4Host: *******************  
                     IPV6Host: *******************    
                     HostName: *******************    
    ----------------------------------------------------------------------
                     Username: root                         
                     Password: *******************                     
                     Username: user                         
                     Password: *******************                     
    ----------------------------------------------------------------------
                                                                          
    Port Mapping Details:
           
             10101-10121:10101-10121 
             10123-10139:10123-10139 
             10142-10199:10142-10199
                                                                          
    Container Volume Map:                                                 
        Host: /home/ocis/OCI01 -> OCI: /home/user
                                                                          
    ----------------------------------------------------------------------
                                                                          
    SSHLogin Private Key:
    *******************
                                                                          
    SSHLogin Public Key:
    *******************
                                                                          
    ----------------------------------------------------------------------
    Note: Saved password in ./Backups/passwd.conf, please delete if need! 
    For any questions or suggestions, please visit:                       
                     https://github.com/PIKACHUIM/DockerFiles             
    ──────────────────────────────────────────────────────────────────────
    ======================= Enter to back to menu ========================

Connect 使用容器

  1. 下载NoMachine,然后安装 / Download NoMachine, Then install
  2. 打开NoMachine,选择左上角的Add,添加远程桌面

    Open NoMachine, select 'Add' and add remote desktop

    host:您docker所在主机地址 / Your Docker host address

    port:上面列出的端口,为1+ID+40,例如ID01,则端口为10140

    The ports listed above. 1 + ID + 40 . For example, if ID is 01 , then the port is 10140

  3. 然后您可以连接,用户名可以是root或者user,密码是上面列出Password: 后面内容

    Then you can connect, the username can be 'root' or 'user', and the password is listed above

Q&A 错误排查

  1. 无法连接远程服务器 / Unable to connect to remote server

    • 检查服务器IP地址、防火墙端口是否打开

      Check if the server IP address and firewall are open

    • 检查Docker是否安装、容器是否超过启动

      Check if Docker is installed and if the container has exceeded startup time

    • 检查NoMachine服务是否正常运行

      Check if the NoMachine service is running properly

      在主机上执行:docker exec -it 容器名称 bash -c "ps -ef | grep nxserve"

      Execute on the host: docker exec -it Name bash -c "ps -ef | grep nxserve"

      正常情况输出(Normal output):

      nx ...... /usr/NX/bin/nxserver.bin root 1898 --daemon
      nx ...... /usr/NX/bin/nxserver.bin -c /etc/NX/nxserver --login -H 9
    • 如果没有,可以尝试运行(If not, you can try running it)

      docker exec -it Name bash -c "/etc/NX/nxserver --startup"
  2. 没有桌面/黑屏/白屏/卡死 / No desktop/black screen/white screen/stuck

Last modification:August 12, 2024
If you think my article is useful to you, please feel free to appreciate