docker 安装vncserver 并使用浏览器登录

2026年1月3日00:04:22 发表评论 1 views

 

 

 


mkdir -p ~/vnc
cd ~/vnc

cat > docker-compose.yml <<'EOF'
services:
desktop:
image: consol/ubuntu-xfce-vnc:latest
container_name: vnc-desktop
restart: unless-stopped
ports:
- "6901:6901" # noVNC(浏览器)
- "5901:5901" # 传统 VNC
environment:
- VNC_PW=ChangeMe_123456
- VNC_RESOLUTION=1280x800
- VNC_COL_DEPTH=24
volumes:
- ./home:/home/ubuntu
EOF

# 最后通过浏览器登录即可:
docker logs -f vnc-desktop</pre>
------------------ VNC environment started ------------------

VNCSERVER started on DISPLAY= :1
=> connect via VNC viewer with 172.19.0.2:5901

noVNC HTML client started:
=> connect via http://172.19.0.2:6901/?password=...
<pre>

 

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: