我尝试了几个步骤并多次在容器中为 Ubuntu 桌面构建 Docker 映像。
我的步骤如下:
- 使用ubuntu官方的Docker镜像:
docker run -tid --name xrdp -p 3389:3389 ubuntu:latest
- 附加到容器:
docker attach xrdp
- 更新系统:
apt update
- 安装 GNOME 桌面环境:
apt install ubuntu-desktop -y
- 安装
xrdp
apt install xrdp -y
- 设置密码
root
并启动xrdp
服务:
passwd root
service xrdp start
mstsc.exe
使用本地机器连接到容器。- 输入用户名和密码(使用
root
用户凭证) - 看起来好像通过了身份验证,但是它立即断开了连接,总是立即退出。
- 我观察到容器的输出中有一些错误或警告消息:
xrdp-sesman[25229]: [INFO ] Socket 7: AF_INET6 connection received from ::ffff:127.0.0.1 port 42214
xrdp-sesman[25229]: [INFO ] Terminal Server Users group is disabled, allowing authentication
xrdp-sesman[25229]: [INFO ] ++ created session (access granted): username root, ip ::ffff:221.212.116.25:1207 - socket: 11
xrdp-sesman[25229]: [INFO ] starting Xorg session...
xrdp-sesman[25229]: [INFO ] Starting session: session_pid 25239, display :10.0, width 2560, height 1600, bpp 24, client ip ::ffff:221.212.116.25:1207 - socket: 11, user name root
xrdp-sesman[25239]: [INFO ] [session start] (display 10): calling auth_start_session from pid 25239
xrdp-sesman[25229]: [ERROR] sesman_data_in: scp_process_msg failed
xrdp-sesman[25239]: pam_unix(xrdp-sesman:session): session opened for user root(uid=0) by (uid=0)
xrdp-sesman[25239]: pam_systemd(xrdp-sesman:session): Failed to connect to system bus: No such file or directory
xrdp-sesman[25229]: [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
xrdp-sesman[25241]: [INFO ] Starting X server on display 10: /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
xrdp-sesman[25240]: [INFO ] Found X server running at /tmp/.X11-unix/X10
xrdp-sesman[25239]: [INFO ] Found X server running at /tmp/.X11-unix/X10
xrdp-sesman[25240]: [INFO ] Found X server running at /tmp/.X11-unix/X10
xrdp-sesman[25239]: [INFO ] Session started successfully for user root on display 10
xrdp-sesman[25244]: [INFO ] Starting the xrdp channel server for display 10
xrdp-sesman[25240]: [INFO ] Starting the default window manager on display 10: /etc/xrdp/startwm.sh
xrdp-sesman[25239]: [INFO ] Session in progress on display 10, waiting until the window manager (pid 25240) exits to end the session
xrdp-chansrv[25244]: [INFO ] Socket 12: AF_UNIX connection received
xrdp-chansrv[25244]: [INFO ] sound_process_training: round trip time 101
xrdp-sesman[25239]: [WARN ] Window manager (pid 25240, display 10) exited with non-zero exit code 255 and signal 5. This could indicate a window manager config problem
xrdp-sesman[25239]: [WARN ] Window manager (pid 25240, display 10) exited quickly (1 secs). This could indicate a window manager config problem
xrdp-sesman[25239]: [INFO ] Calling auth_stop_session and auth_end from pid 25239
xrdp-sesman[25239]: pam_unix(xrdp-sesman:session): session closed for user root
xrdp-sesman[25239]: [INFO ] Terminating X server (pid 25241) on display 10
xrdp-sesman[25239]: [INFO ] Terminating the xrdp channel server (pid 25244) on display 10
xrdp-sesman[25239]: [INFO ] X server on display 10 (pid 25241) returned exit code 0 and signal number 0
xrdp-sesman[25239]: [INFO ] xrdp channel server for display 10 (pid 25244) exit code 0 and signal number 0
xrdp-sesman[25239]: [INFO ] cleanup_sockets:
xrdp-sesman[25229]: [INFO ] ++ terminated session: username root, display :10.0, session_pid 25239, ip ::ffff:221.212.116.25:1207 - socket: 11
然后,我在网上搜索,有人谈到在文件中插入一些内容~/.xsession
,但是我在目录中找不到这个文件~/
。
那么,如果我想在 Docker 容器中为 ubuntu 启用 GNOME 桌面环境并使用 XRDP 从远程机器访问,我该怎么做?
感谢您的时间!