brainlife / ui-freeview

FreeView / noVNC docker container used by brain-life UI
MIT License
0 stars 0 forks source link

Open vncserver with launched freeview #3

Open relyativist opened 4 years ago

relyativist commented 4 years ago

I am trying to run freeview gui wiwth vncserver and docker. How could it be launched with docker run command? Now i have to launch vncserver, go to the ubuntu vnc open terminal inside it, export variables for freeview and the exec freeview. xstartup impementation is not working, terminating with error:

QXcbConnection: Could not connect to display
Could not connect to any X display.

Here is my unsuccessful implementation of startup.sh:

/opt/TurboVNC/bin/vncserver -geometry 1200x800 && websockify -D --web=/usr/share/novnc/ --cert=~/novnc.pem 80 localhost:5901 & 

echo "Setting the environment ..."

source $FREESURFER_HOME/SetUpFreeSurfer.sh

vglrun /usr/local/freesurfer/bin/freeview

echo "FreeView Launched"

tail -f /dev/null

and Dockerfile:

FROM ubuntu:16.04
ENV USER=root
ENV PASSWORD=password1
ENV DEBIAN_FRONTEND=noninteractive 
ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl g++ wget ca-certificates libxt6 xfce4 libxrandr2 patch unzip zip pigz jq cmake moreutils time bzip2 libxv1 libxmu6 mesa-utils libc6-dev tcsh libgomp1 libjpeg62 mesa-utils libglu1 libfreetype6-dev libfontconfig libglib2.0-0 libqt5widgets5 libqt5x11extras5 libglu1-mesa qt5-default libqt4-scripttools libqt4-opengl libxss1 libxft2 libegl1-mesa libqt5dbus5 novnc xfonts-base x11-utils xorg ratpoison tightvncserver && \
    wget https://svwh.dl.sourceforge.net/project/virtualgl/2.6.3/virtualgl_2.6.3_amd64.deb && \
    wget https://iweb.dl.sourceforge.net/project/turbovnc/2.2.4/turbovnc_2.2.4_amd64.deb && \
    curl ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.1.1/freesurfer-linux-centos6_x86_64-7.1.1.tar.gz | tar xz -C /usr/local && \
    dpkg -i virtualgl_*.deb && \
    dpkg -i turbovnc_*.deb
RUN mkdir ~/.vnc/ && \
    mkdir ~/.dosbox && \
    mkdir /code && \
    echo $PASSWORD | vncpasswd -f > ~/.vnc/passwd && \
    chmod 0600 ~/.vnc/passwd && \
    echo "set border 1" > ~/.ratpoisonrc  && \
        echo "vglclient" > ~/.ratpoisonrc  && \
        echo "vglrun freeview">> ~/.ratpoisonrc && \
    openssl req -x509 -nodes -newkey rsa:2048 -keyout ~/novnc.pem -out ~/novnc.pem -days 3650 -subj "/C=US/ST=NY/L=NY/O=NY/OU=NY/CN=NY emailAddress=email@example.com"
COPY freesurfer_license.txt /usr/local/freesurfer/.license
COPY startup.sh /code/startup.sh
ENV export FREESURFER_HOME=/usr/local/freesurfer
ENV export SUBJECTS_DIR=$FREESURFER_HOME/subjects
EXPOSE 80
ENTRYPOINT ["bash", "-c", "source /code/startup.sh"]
soichih commented 4 years ago

Hello! Can you tell me what kind of environment are you running this on? Are you running in on your computer, or on a cluster, or cloud VM? Also, if you are just wanting to run freeview, there is an easier way to run it.. Is there a reason why you are interested in our container?

relyativist commented 4 years ago

Hi, I am running it on linux server, version: Linux mint, 19.1. The reason I want to use a container is implement remote visualizer to check results of freesurfer, not to copy it on the local machine.

francopestilli commented 4 years ago

hi @relyativist which systems is this being run over, thanks!

relyativist commented 4 years ago

Hi @francopestilli

What is working

vncserver is working, able to run freeview inside consol of vncserver

What is not working

1) virtual gl is not working, freeview use only cpu 2) Can't start container with only freeview availabe, xstartup is crashing with error:

QXcbConnection: Could not connect to display
Aborted (core dumped)