From 69bbffebf40dcc2aa3fb2bcb9412060af4d60533 Mon Sep 17 00:00:00 2001 From: fxia22 Date: Mon, 1 Oct 2018 11:29:20 -0700 Subject: [PATCH] merge two dockerfiles --- Dockerfile | 2 +- Dockerfile_server | 130 ---------------------------------------------- README.md | 33 ++++++------ 3 files changed, 17 insertions(+), 148 deletions(-) delete mode 100644 Dockerfile_server diff --git a/Dockerfile b/Dockerfile index 7244f236..86bf362e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ # docker build -t gibson . # docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix gibson -FROM nvidia/cudagl:9.0-base-ubuntu16.04 +FROM nvidia/cudagl:9.0-runtime-ubuntu16.04 RUN apt-get update && apt-get install -y --no-install-recommends \ cuda-samples-$CUDA_PKG_VERSION && \ diff --git a/Dockerfile_server b/Dockerfile_server deleted file mode 100644 index f1162cbf..00000000 --- a/Dockerfile_server +++ /dev/null @@ -1,130 +0,0 @@ -# gibson graphical sample provided with the CUDA toolkit. - -# docker build -t gibson . -# docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix gibson - -FROM nvidia/cudagl:9.0-base-ubuntu16.04 - - -ARG TURBOVNC_VERSION=2.1.2 -ARG VIRTUALGL_VERSION=2.5.2 -ARG LIBJPEG_VERSION=1.5.2 -ARG WEBSOCKIFY_VERSION=0.8.0 -ARG NOVNC_VERSION=1.0.0-beta - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - libc6-dev \ - libglu1 \ - libglu1:i386 \ - libsm6 \ - libxv1 \ - libxv1:i386 \ - make \ - python \ - python-numpy \ - x11-xkb-utils \ - xauth \ - xfonts-base \ - xkb-data && \ - rm -rf /var/lib/apt/lists/* - -RUN cd /tmp && \ - curl -fsSL -O https://svwh.dl.sourceforge.net/project/turbovnc/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb \ - -O https://svwh.dl.sourceforge.net/project/libjpeg-turbo/${LIBJPEG_VERSION}/libjpeg-turbo-official_${LIBJPEG_VERSION}_amd64.deb \ - -O https://svwh.dl.sourceforge.net/project/virtualgl/${VIRTUALGL_VERSION}/virtualgl_${VIRTUALGL_VERSION}_amd64.deb \ - -O https://svwh.dl.sourceforge.net/project/virtualgl/${VIRTUALGL_VERSION}/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb && \ - dpkg -i *.deb && \ - rm -f /tmp/*.deb && \ - sed -i 's/$host:/unix:/g' /opt/TurboVNC/bin/vncserver - -ENV PATH ${PATH}:/opt/VirtualGL/bin:/opt/TurboVNC/bin - -RUN curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \ - curl -fsSL https://github.com/novnc/websockify/archive/v${WEBSOCKIFY_VERSION}.tar.gz | tar -xzf - -C /opt && \ - mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \ - mv /opt/websockify-${WEBSOCKIFY_VERSION} /opt/websockify && \ - ln -s /opt/noVNC/vnc_lite.html /opt/noVNC/index.html && \ - cd /opt/websockify && make - -RUN echo 'no-remote-connections\n\ -no-httpd\n\ -no-x11-tcp-connections\n\ -no-pam-sessions\n\ -permitted-security-types = otp\ -' > /etc/turbovncserver-security.conf - -EXPOSE 5901 -ENV DISPLAY :1 - - - -RUN apt-get update && apt-get install -y --no-install-recommends \ - cuda-samples-$CUDA_PKG_VERSION && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /usr/local/cuda/samples/5_Simulations/nbody - -RUN make - -#CMD ./nbody - -RUN apt-get update && apt-get install -y curl - -# Install miniconda to /miniconda -RUN curl -LO http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -RUN bash Miniconda-latest-Linux-x86_64.sh -p /miniconda -b -RUN rm Miniconda-latest-Linux-x86_64.sh -ENV PATH=/miniconda/bin:${PATH} -RUN conda update -y conda -RUN conda create -y -n py35 python=3.5 -# Python packages from conda - -ENV PATH /miniconda/envs/py35/bin:$PATH - -RUN pip install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp35-cp35m-linux_x86_64.whl -RUN pip install torchvision==0.2.0 -RUN pip install tensorflow==1.3 - -WORKDIR /root - -RUN apt-get install -y git build-essential cmake libopenmpi-dev - -RUN apt-get install -y zlib1g-dev tmux - -RUN git clone https://github.com/fxia22/baselines.git&& \ - pip install -e baselines - -RUN apt-get update && apt-get install -y \ - libglew-dev \ - libglm-dev \ - libassimp-dev \ - xorg-dev \ - libglu1-mesa-dev \ - libboost-dev \ - mesa-common-dev \ - freeglut3-dev \ - libopenmpi-dev \ - cmake \ - golang \ - libjpeg-turbo8-dev \ - wmctrl \ - xdotool \ - && \ - apt-get clean && \ - apt-get autoremove && \ - rm -rf /var/cache/apk/* - -RUN apt-get install -y vim wget unzip - -RUN apt-get install -y libzmq3-dev - -ADD . /root/mount/gibson -WORKDIR /root/mount/gibson - -RUN bash build.sh build_local -RUN pip install -e . - -ENV QT_X11_NO_MITSHM 1 diff --git a/README.md b/README.md index 7abdfeba..d5f1ae85 100644 --- a/README.md +++ b/README.md @@ -86,9 +86,15 @@ We use docker to distribute our software, you need to install [docker](https://d Run `docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi` to verify your installation. -You can either 1. build your own docker image or 2. pull from our docker image. +You can either 1. pull from our docker image or 2. build your own docker image. -1. Build your own docker image (recommended) + +1. Pull from our docker image (recommended) +```bash +docker pull xf1280/gibson:0.3.1 +``` + +2. Build your own docker image ```bash git clone https://github.com/StanfordVL/GibsonEnv.git cd GibsonEnv @@ -99,27 +105,20 @@ If the installation is successful, you should be able to run `docker run --runti dataset files in docker image to keep our image slim, so you will need to mount it to the container when you start a container. -2. Or pull from our docker image -```bash -docker pull xf1280/gibson:0.3.1 -``` #### Notes on deployment on a headless server -We have another docker file that supports deployment on a headless server and remote access with TurboVNC+virtualGL. -You can build your own docker image with the docker file `Dockerfile_server`. +Gibson Env supports deployment on a headless server and remote access with `x11vnc`. +You can build your own docker image with the docker file `Dockerfile` as above. Instructions to run gibson on a headless server (requires X server running): -1. Install nvidia-docker2 dependencies following the starter guide. -2. Use `openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem` create `self.pem` file -3. `docker build -f Dockerfile_server -t gibson_server .` use the `Dockerfile_server` to build a new docker image that support virtualgl and turbovnc -4. `docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v :/root/mount/gibson/gibson/assets/dataset -p 5901:5901 gibson_server` -in docker terminal, start `/opt/websockify/run 5901 --web=/opt/noVNC --wrap-mode=ignore -- vncserver :1 -securitytypes otp -otp -noxstartup` in background, potentially with `tmux` -5. Run gibson with `DISPLAY=:1 vglrun python ` -6. Visit your `host:5901` and type in one time password to see the GUI. +1. Install nvidia-docker2 dependencies following the starter guide. Install `x11vnc` with `sudo apt-get install x11vnc`. +2. Have xserver running on your host machine, and run `x11vnc` on DISPLAY :0. +2. `docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v :/root/mount/gibson/gibson/assets/dataset ` +5. Run gibson with `python ` inside docker. +6. Visit your `host:5900` and you should be able to see the GUI. If you don't have X server running, you can still run gibson, see [this guide](https://github.com/StanfordVL/GibsonEnv/wiki/Running-GibsonEnv-on-headless-server) for more details. - B. Building from source ----- If you don't want to use our docker image, you can also install gibson locally. This will require some dependencies to be installed. @@ -168,7 +167,7 @@ Uninstall gibson is easy. If you installed with docker, just run `docker images Quick Start ================= -First run `xhost +local:root` on your host machine to enable display. You may need to run `export DISPLAY=:0.0` first. After getting into the docker container with `docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v :/root/mount/gibson/gibson/assets/dataset gibson`, you will get an interactive shell. Now you can run a few demos. +First run `xhost +local:root` on your host machine to enable display. You may need to run `export DISPLAY=:0` first. After getting into the docker container with `docker run --runtime=nvidia -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v :/root/mount/gibson/gibson/assets/dataset gibson`, you will get an interactive shell. Now you can run a few demos. If you installed from source, you can run those directly using the following commands without using docker.