为什么需要?
在尝试Mac系统vcpkg中安装qt5失败之后,考虑到用docker安装Ubuntu,能不能在docker中运行GUI程序呢?
没有做不到,只有想不到。
如何实现?
sudo docker run --name ubvnc -p 6080:80 -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc:bionic
-
visit: http://127.0.0.1:6080/#/ which runs a noVNC more limited JavaScript VNC client
-
run:
sudo apt-get install tigervnc-viewer xtigervncviewer :5900
改进
还是docker-compose.yml方便
version: '3.3'
services:
ubuntu-desktop-lxde-vnc:
container_name: ubvnc
ports:
- '6080:80'
- '5901:5900'
- '8888-8898:8888-8898'
volumes:
- './:/root'
- '/dev/shm:/dev/shm'
environment:
- HTTP_PASSWORD=password
- VNC_PASSWORD=password
- RESOLUTION=1600x900
image: 'dorowu/ubuntu-desktop-lxde-vnc:bionic'
docker-compose up -d
结果