Docker构建一个带桌面的ARM架构的Ubuntu镜像
仅为笔记,出现了灰屏,原因未知
FROM arm64v8/ubuntu:latest ENV DEBIAN_FRONTEND noninteractive ENV VNC_ENCODING=raw ENV VNC_QUALITY=6 ENV VNC_AUTOSELECT=0 # 安装基础组件和中文字体 RUN apt-get update && \ apt-get install -y \ locales \ openssl \ fonts-wqy-microhei \ xfonts-wqy \ x11-xserver-utils \ xauth \ sudo \ tightvncserver \ xfonts-base \ xfonts-75dpi \ xfonts-100dpi \ xfonts-cyrillic \ xfonts-scalable \ && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # 配置语言环境 RUN echo "zh_CN.UTF-8 UTF-8" > /etc/locale.gen && \ locale-gen RUN touch ~/.Xauthority && chmod 600 ~/.Xauthority RUN touch /root/.Xresources RUN echo "#!/bin/bash" > /root/.xsession && \ echo "exec /etc/X11/Xsession" >> /root/.xsession && \ chmod +x /root/.xsession RUN mkdir -p /root/.vnc RUN echo "Encoding=jpeg" >> /root/.vnc/config && \ echo "Quality=9" >> /root/.vnc/config && \ echo "AutoSelect=1" >> /root/.vnc/config # 将用户设置为 root 并设置密码 RUN usermod --password $(echo "root" | openssl passwd -1 -stdin) root # 启动 VNC 服务 CMD ["bash", "-c", "vncserver :1 -geometry 1280x800 -depth 24 && tail -F /root/.vnc/*.log"]
构建镜像
sudo docker build -t my-ubuntu-vnc .
运行docker
sudo docker run -it -p 8001:5901 -e VNC_ENCODING=jpeg -e VNC_QUALITY=9 -e VNC_AUTOSELECT=1 -e USER=root my-ubuntu-vnc
本文作者:phae
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!