镜像添加中文剪贴板支持
帮助与服务中心
# 功能介绍
由于vnc协议不支持utf-8的剪贴板传输,因此我们开发了一个qingjiao-guest-agent,用于传输中文粘贴
# 一、安装依赖-以debian系xfce桌面环境为例
RUN apt update && apt -y install xsel xclip
安装剪贴板组件所需依赖
# 二、添加剪贴板组件
RUN curl -L "https://hongyaa-generic.pkg.coding.net/ops-utils/ga/qingjiao-guest-agent-linux?version=prod-latest" -o /usr/local/qingjiao/utils/qingjiao-guest-agent && chmod 755 /usr/local/qingjiao/utils/qingjiao-guest-agent
# 三、将剪贴板组件设置为进入桌面自动启动
为什么要设置到进入桌面自动启动,因为如果使用类似supervisor之类的启动,并不能访问桌面环境,因此一定要是在桌面环境中进行启动
XFCE环境需要创建如下目录
$HOME/.config/autostart
以python镜像为例
RUN curl -L "https://hongyaa-generic.pkg.coding.net/ops-utils/ga/qingjiao-guest-agent-linux?version=prod-latest" -o /usr/local/qingjiao/utils/qingjiao-guest-agent && chmod 755 /usr/local/qingjiao/utils/qingjiao-guest-agent
ADD qingjiao-guest-agent.desktop /home/qingjiao/.config/autostart/
qingjiao-guest-agent.desktop
文件内容如下
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=qingjiao-guest-agent
Comment=
Exec=/usr/local/qingjiao/utils/qingjiao-guest-agent rest start
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
文件路径及内容获取思路
之后使用docker diff命令找到上述文件
# Ps:整理之后,ubuntu中直接使用如下命令:
RUN apt-get update && \
apt install -y xsel xclip && \
curl -L "https://hongyaa-generic.pkg.coding.net/ops-utils/ga/qingjiao-guest-agent-linux?version=prod-latest" -o /usr/local/qingjiao/utils/qingjiao-guest-agent && \
chmod 755 /usr/local/qingjiao/utils/qingjiao-guest-agent && \
mkdir -p /home/qingjiao/.config/autostart/ && \
wget -P /home/qingjiao/.config/autostart/ https://qingjiao-image-build-assets.oss-cn-beijing.aliyuncs.com/hongyaa_tools/qingjiao-guest-agent.desktop && \
chown -R qingjiao:qingjiao /usr/local/qingjiao/ && \
chown -R qingjiao:qingjiao /home/qingjiao/.config
centos中命令为:
RUN yum install -y xsel xclip && \
mkdir -p /usr/local/qingjiao/utils/ && \
curl -L "https://hongyaa-generic.pkg.coding.net/ops-utils/ga/qingjiao-guest-agent-linux?version=prod-latest" -o /usr/local/qingjiao/utils/qingjiao-guest-agent && \
chmod 755 /usr/local/qingjiao/utils/qingjiao-guest-agent && \
mkdir -p $HOME/.config/autostart/ && \
wget -P $HOME/.config/autostart/ https://qingjiao-image-build-assets.oss-cn-beijing.aliyuncs.com/hongyaa_tools/qingjiao-guest-agent.desktop