搭建一个Ubuntu的远程桌面系统(带VNC/noVNC)可以通过浏览器访问

搭建一个Ubuntu的远程桌面系统(带VNC/noVNC)可以通过浏览器访问

admin
2022-07-03 / 0 评论 / 4 阅读 / 正在检测是否收录...

1.初始化设置

apt update -y  # 升级packages

apt install wget  #如果出现 wget:command not found,可以用这个命令安装

mkdir -p /root/data/docker_data/Ubuntu_desktop

cd /root/data/docker_data/Ubuntu_desktop

nano docker-compose.yml

mkdir Downloads Documents Pictures Videos Music

2.编辑docker-compose.yml文件

version: '3.5'

services:
    ubuntu-xfce-vnc:
        container_name: xfce
        image: imlala/ubuntu-xfce-vnc-novnc:latest
        shm_size: "1gb"  # 防止高分辨率下Chromium崩溃,如果内存足够也可以加大一点点
        ports:
            - 5900:5900   # TigerVNC的服务端口(保证端口是没被占用的,冒号右边的端口不能改,左边的可以改)
            - 6080:6080   # noVNC的服务端口,注意事项同上
        environment: 
            - VNC_PASSWD=PAS3WorD    # 改成你自己想要的密码
            - GEOMETRY=1280x720      # 屏幕分辨率,800×600/1024×768诸如此类的可自己调整
            - DEPTH=24               # 颜色位数16/24/32可用,越高画面越细腻,但网络不好的也会更卡
        volumes: 
            - ./Downloads:/root/Downloads  # Chromium/Deluge/qBittorrent/Transmission下载的文件默认保存位置都是root/Downloads下
            - ./Documents:/root/Documents  # 映射一些其他目录
            - ./Pictures:/root/Pictures
            - ./Videos:/root/Videos
            - ./Music:/root/Music
        restart: unless-stopped

3.启动容器

docker-compose up -d 

4.https访问
安装 Nginx Proxy Manager 进行反向代理,勾选Websockets支持

PS:
另一个类似的项目

docker run -itd --restart=always -p 6080:80 -e HTTP_PASSWORD=mypassword -v /root/data/docker_data/Ubuntu_desktop/dev/shm:/dev/shm dorowu/ubuntu-desktop-lxde-vnc

可以卸载镜像中无用的软件

FROM imlala/ubuntu-xfce-vnc-novnc

RUN rm /etc/apt/sources.list.d/*
RUN apt -y update
RUN apt -y autoremove xfburn deluge qbittorrent transmission telegram-desktop libllvm9
RUN apt -y upgrade

CMD ["/start.sh"]
0

评论 (0)

取消