diff --git a/Dockerfile b/Dockerfile index 2f23bd2..33e294f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,23 @@ -FROM ubuntu:16.04 +# FROM ubuntu:16.04 +FROM ubuntu:18.04 + # Make all NVIDIA GPUS visible, but I want to manually install drivers ARG NVIDIA_VISIBLE_DEVICES=all # Supress interactive menu while installing keyboard-configuration ARG DEBIAN_FRONTEND=noninteractive +# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Failed to execute child process dbus-launch (No such file or directory) +# fix by setting LANG https://askubuntu.com/questions/608330/problem-with-gnome-terminal-on-gnome-3-12-2 +# to install locales https://stackoverflow.com/questions/39760663/docker-ubuntu-bin-sh-1-locale-gen-not-found +RUN apt-get clean && \ + apt-get update && \ + apt-get install -y locales && \ + rm -rf /var/lib/apt/lists/* && \ + locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 # (1) Install Xorg and NVIDIA driver inside the container # Almost same procesure as nvidia/driver https://gitlab.com/nvidia/driver/blob/master/ubuntu16.04/Dockerfile @@ -30,6 +43,8 @@ # (1-2) Install xorg server and xinit BEFORE INSTALLING NVIDIA DRIVER. # After this installation, command Xorg and xinit can be used in the container +# if you need full ubuntu desktop environment, the line below should be added. + # ubuntu-desktop \ RUN apt-get update && apt-get install -y \ xinit && \ rm -rf /var/lib/apt/lists/* @@ -38,11 +53,12 @@ # Same command as nvidia/driver, except --x-{prefix,module-path,library-path,sysconfig-path} are omitted in order to make use default path and enable X drivers. # Driver version must be equal to host's driver # Install the userspace components and copy the kernel module sources. -ENV DRIVER_VERSION=418.87.01 +ENV DRIVER_VERSION=410.129-diagnostic +ENV DRIVER_VERSION_PATH=410.129 RUN cd /tmp && \ - curl -fSsl -O https://us.download.nvidia.com/tesla/418.87/NVIDIA-Linux-x86_64-418.87.01.run && \ + curl -fSsl -O https://us.download.nvidia.com/tesla/$DRIVER_VERSION_PATH/NVIDIA-Linux-x86_64-$DRIVER_VERSION.run && \ sh NVIDIA-Linux-x86_64-$DRIVER_VERSION.run -x && \ - cd NVIDIA-Linux-x86_64-$DRIVER_VERSION* && \ + cd NVIDIA-Linux-x86_64-$DRIVER_VERSION && \ ./nvidia-installer --silent \ --no-kernel-module \ --install-compat32-libs \ @@ -57,8 +73,7 @@ --no-install-libglvnd && \ mkdir -p /usr/src/nvidia-$DRIVER_VERSION && \ mv LICENSE mkprecompiled kernel /usr/src/nvidia-$DRIVER_VERSION && \ - sed '9,${/^\(kernel\|LICENSE\)/!d}' .manifest > /usr/src/nvidia-$DRIVER_VERSION/.manifest && \ - rm -rf /tmp/* + sed '9,${/^\(kernel\|LICENSE\)/!d}' .manifest > /usr/src/nvidia-$DRIVER_VERSION/.manifest # this option cannot be used on newer driver # --no-glvnd-egl-client \ # --no-glvnd-glx-client \ @@ -71,12 +86,23 @@ # x11vnc: Make connection between x11 server and VNC client. # x11-apps: xeyes can be used to make sure that X11 server is running. # +# Note: x11vnc in ubuntu18.04 is useless beacuse of stack smashing bug. See below to manual compilation. RUN apt-get update && apt-get install -y --no-install-recommends \ mesa-utils \ - x11vnc \ x11-apps && \ rm -rf /var/lib/apt/lists/* +# solution for the `stack smashing detected` issue +# https://github.com/LibVNC/x11vnc/issues/61 +RUN apt-get update && apt-get install -y --no-install-recommends \ + automake autoconf libssl-dev xorg-dev libvncserver-dev && \ + rm -rf /var/lib/apt/lists/* && \ + git clone https://github.com/LibVNC/x11vnc.git && \ + cd x11vnc && \ + ./autogen.sh && \ + make && \ + cp src/x11vnc /usr/bin/x11vnc + # (2-2) Optional vulkan support # vulkan-utils includes vulkan-smoketest, benchmark software of vulkan API RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -102,6 +128,14 @@ rm -rf v1.1.0.zip && \ git clone https://github.com/novnc/websockify /noVNC-1.1.0/utils/websockify +# Xorg segfault error +# dbus-core: error connecting to system bus: org.freedesktop.DBus.Error.FileNotFound (Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory) +# related? https://github.com/Microsoft/WSL/issues/2016 +RUN apt-get update && apt-get install -y --no-install-recommends \ + dbus-x11 \ + libdbus-c++-1-0v5 && \ + rm -rf /var/lib/apt/lists/* + # (3) Run Xorg server + x11vnc + X applications # see run.sh for details COPY run.sh /run.sh diff --git a/run.sh b/run.sh index 40c5a16..cf6d4e6 100644 --- a/run.sh +++ b/run.sh @@ -12,7 +12,7 @@ sleep 2 # wait for the server gets ready # 2. start x11 and vnc connection -x11vnc -display :0 -passwd pass -forever -rfbport 5900 & +x11vnc -display :0 -passwd pass -forever -rfbport 5900 --verbose & sleep 2 # wait for the server gets ready # 2.5 start audio