Skip to content

Instantly share code, notes, and snippets.

@rdpanek
Created August 13, 2020 07:56
Show Gist options
  • Select an option

  • Save rdpanek/9768778e9f6420c07b8799b89913dd5d to your computer and use it in GitHub Desktop.

Select an option

Save rdpanek/9768778e9f6420c07b8799b89913dd5d to your computer and use it in GitHub Desktop.

Revisions

  1. rdpanek created this gist Aug 13, 2020.
    50 changes: 50 additions & 0 deletions DockerfileWithVNCServer
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    # https://raw.githubusercontent.com/ConSol/docker-headless-vnc-container/master/Dockerfile.ubuntu.xfce.vnc

    #Dockerfile

    FROM centos:8
    MAINTAINER RDPanek "rdpanek@gmail.com"

    LABEL io.k8s.description="VNC Container based on Centos" \
    io.k8s.display-name="VNC Container based on Centos" \
    io.openshift.expose-services="5901:xvnc" \
    io.openshift.tags="vnc, centos, xfce" \
    io.openshift.non-scalable=true

    ENV DISPLAY=:1 \
    VNC_PORT=5901

    EXPOSE $VNC_PORT

    ### Envrionment config
    ENV USER=root \
    VNC_COL_DEPTH=24 \
    VNC_RESOLUTION=1280x1024 \
    VNC_PW=secret

    ### Install dependencies
    RUN yum -y install epel-release && \
    yum groupinstall "Xfce" -y && \
    yum -y install tigervnc-server tigervnc-server-minimal && \
    yum clean all

    ### Setup VNC
    ADD ./scripts/xstartup /opt
    RUN mkdir ~/.vnc && \
    PASSWD_PATH=~/.vnc/passwd && \
    echo $VNC_PW | vncpasswd -f >> $PASSWD_PATH && \
    chmod 600 $PASSWD_PATH && \
    mv /opt/xstartup ~/.vnc/xstartup && \
    chmod +x ~/.vnc/xstartup

    # entrypoint
    #!/bin/bash

    echo "ᐰ"
    vncserver -geometry $VNC_RESOLUTION -depth $VNC_COL_DEPTH :1
    tail -f /root/.vnc/*.log

    # scripts/xstartup
    #!/bin/bash
    xrdb $HOME/.Xresources
    startxfce4 &