赞
踩
# 启动容器
# -e USER=u20 vncserver所需环境变量
# -p 15901:5901 vncserver所需端口
docker run -id --privileged=true --restart always --user=u20 --workdir=/home/u20 -p 15901:5901 -e USER=u20 --name ui u20:dev
# 进入容器
docker exec -it ui /bin/bash
# 更新软件
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y xorg openbox xfce4 xfce4-goodies
# 1. gdm3 2. lightdm
# Default display manager:
# Select 2
# 1. 无法使用终端
sudo apt-get install xfce4-terminal
sudo update-alternatives --config x-terminal-emulator # Select xfce4-terminal.
# 2. 中文乱码
sudo apt-get install -y locales
sudo dpkg-reconfigure locales
# 语言编码选择 en_US.UTF8,zh_CN GB2312,zh_CN GBK GBK,zh_CN UTF-8 UTF-8,即:159 488 490 491
# 为当前用户配置默认语言为中文zh_CN UTF-8 UTF-8,在~/.bashrc最后添加一行 export LANG=zh_CN.UTF-8
# 安装中文字体:sudo apt-get install -y fonts-wqy-zenhei
# ubuntu 20.04
sudo apt-get install -y tightvncserver
vncserver
vncserver -kill :1
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
vim ~/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
startxfce4 &
chmod +x ~/.vnc/xstartup
vncserver -geometry 1920x1080 -depth 24
# New 'X' desktop is 1f84fb9bb726:1
#
# Starting applications specified in /home/u20/.vnc/xstartup
# Log file is /home/u20/.vnc/1f84fb9bb726:1.log
# 列出已启动的虚拟桌面
vncserver -list
# 查询状态
sudo apt-get install -y net-tools
netstat -ntupl
# Active Internet connections (only servers)
# Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
# tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 9233/Xtigervnc
# tcp6 0 0 :::5901 :::* LISTEN 9233/Xtigervnc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。