将noVNC-1.0.0复制到容器的/root目录下
1.制作启动脚本
vim /root/novnc_start.sh
#!/bin/bash
nohup /root/noVNC-1.0.0/utils/launch.sh --vnc localhost:5901 &
echo $! > /var/run/novnc.pid
2.制作service
vim /etc/systemd/system/novnc.service
[Unit]
Description=novnc service
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
User=root
Group=root
ExecStart=/bin/bash /root/novnc_start.sh
ExecStop=/bin/kill -9 $MAINPID
Restart=on-failure
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3.服务自启动
systemctl daemon-reload
systemctl enable novnc
systemctl start novnc
systemctl status novnc