docker内运行图形界面

docker内运行图形界面dorowu/ubuntu-desktop-lxde-vnc(可用浏览器访问桌面)

[https://www.cnblogs.com/xiao987334176/p/12290348.html]

获取镜像

docker pull dorowu/ubuntu-desktop-lxde-vnc

运行

docker run -d -p 6080:80 -p 590:59 -e VNC_PASSWORD=qsbye -v /dev/shm:/dev/shm dorowu/ubuntu-desktop-lxde-vnc:latest
宿主机:浏览器打开127.0.0.1:6080即可访问
密码为VNC_PASSWORD设置的

noVNC(基于web的VNC)

[https://zhuanlan.zhihu.com/p/427144657]
noVNC项目是通过取消VNC Client的安装,直接通过浏览器访问noVNC,然后由noVNC间接访问VNC server来达到client web化.

linux桌面环境

  • gnome
  • Xfce:轻量桌面环境
  • MATE
  • LXDE(LXQt):超轻桌面

docker内运行图形界面(on MacOS)

Mac宿主机:

brew install socat
brew install xquartz
配置Socat:
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY"
注意这个进程一直是运行状态,不要中断它
配置Xquartz:
open -a Xquartz

重启Xquartz
查看ip:
ifconfig
运行镜像:
docker run -it -e DISPLAY=192.168.1.249:0 -v /Users/workspace/Downloads/hello:/tmp --privileged=true swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0 /bin/bash

Docker容器内:

配置xwindow

apt update
apt install xserver-xorg
apt install x-window-system-core
dpkg-reconfigure xserver-xorg
apt install gnome-core
选择时区Asia Shanghai
apt install xdm
apt install ubuntu-desktop
apt install xscreensaver
apt install ttf-arphic*

宿主机

docker ps
docker restart [容器id]
docker attach [容器id]

Ubuntu

startx

报错:Fatal server error: no screens found
https://lists.debian.org/debian-laptop/2002/04/msg00070.html,https://segmentfault.com/q/1010000000177773/a-1020000000178028?sort=created怀疑是没有显卡设备
失败
apt install xarclock
xarclock

参考文献

  1. 如何在docker中运行ubuntukylin桌面系统
  2. 实现Mac主机上的Docker容器中的图形界面显示(运行GUI应用)
  3. 在windows下使用Xming显示群辉Docker镜像里软件图形界面(Windows 宿主主机)
  4. noVNC+VNCserver实现远程访问Docker容器桌面
  5. Ubuntu server版本上安装xwindow
posted @ 2022-08-13 10:08  qsBye  阅读(2546)  评论(0编辑  收藏  举报