From a6dbbfd10747ea5aab4424495fc38eab527ae33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B2=B3=E6=9D=BE?= Date: Wed, 19 Oct 2016 17:33:28 +0800 Subject: [PATCH] centos --- Dockerfile | 15 +++++++++------ vnc.sh | 13 +++++++------ xstartup | 20 +++++--------------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index d891bce..793b905 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -FROM ubuntu +FROM centos:6 -RUN apt-get update -y \ - && apt-get install -y wget firefox xfce4 vnc4server -ENV DISPLAY=":1" VNC_COL_DEPTH=24 VNC_RESOLUTION=1280x800 VNC_PW=xiaosong +RUN yum update -y \ + && yum -y install wget vim tigervnc-server epel-release firefox \ + && yum -y groupinstall xfce \ + && yum clean all +ENV VNC_PW=xiaosong RUN mkdir /root/.vnc/ \ && wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.635/install_flash_player_11_linux.x86_64.tar.gz \ && mkdir flash_player \ @@ -10,9 +12,10 @@ RUN mkdir /root/.vnc/ \ && mkdir -p ~/.mozilla/plugins/ \ && cp flash_player/libflashplayer.so ~/.mozilla/plugins/ \ && rm -rf flash_player install_flash_player_11_linux.x86_64.tar.gz - EXPOSE 5901 COPY xstartup /root/.vnc/ COPY vnc.sh /opt/ -RUN chmod +x /root/.vnc/xstartup /etc/X11/xinit/xinitrc +RUN chmod +x /opt/vnc.sh /root/.vnc/xstartup /etc/X11/xinit/xinitrc \ + && echo "VNCSERVERS=\"1:root\"" >> /etc/sysconfig/vncservers \ + && echo "VNCSERVERARGS[1]=\"-geometry 1280x800 -depth 24\"" >> /etc/sysconfig/vncservers ENTRYPOINT ["/opt/vnc.sh"] \ No newline at end of file diff --git a/vnc.sh b/vnc.sh index ff30315..e183047 100644 --- a/vnc.sh +++ b/vnc.sh @@ -1,10 +1,11 @@ -#!/bin/bash +#!/bin/sh ##change vnc password echo "change vnc password!" -(echo $VNC_PW && echo $VNC_PW) | vncpasswd - +echo "$VNC_PW\n$VNC_PW\n\n" | vncpasswd -f > /root/.vnc/passwd +chmod 0600 /root/.vnc/passwd ##start vncserver -vncserver -kill :1 && rm -rfv /tmp/.X* ; echo "remove old vnc locks to be a reattachable container" -vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -sleep 1 \ No newline at end of file +echo "remove old vnc locks to be a reattachable container" +rm -rfv /tmp/.X* +chkconfig vncserver on +service vncserver start && bash diff --git a/xstartup b/xstartup index 819248a..16d55db 100644 --- a/xstartup +++ b/xstartup @@ -1,20 +1,10 @@ #!/bin/sh - +# Uncomment the following two lines for normal desktop: unset SESSION_MANAGER -#unset DBUS_SESSION_BUS_ADDRESS - -#startxfce4 & -#export XKL_XMODMAP_DISABLE=1 - - +#exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey -vncconfig -iconic & - -exec /etc/X11/xinit/xinitrc -#/etc/xdg/xfce4/xinitrc - -x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & -#exec /usr/bin/xfce4-session & -exec /etc/X11/xinit/xinitrc \ No newline at end of file +#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & +#twm & +startxfce4 & \ No newline at end of file