From 5349a1f6376553341ae882b5c642281a439d10a9 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Tue, 21 Jun 2016 22:23:28 -0400 Subject: [PATCH 01/11] Changes for latest NVidia Linux drivers, circa 361.45.11 --- ubuntuWithNvidiaDriver/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 1790e4f..25b393d 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get install -y mesa-utils # install nvidia driver RUN apt-get install -y binutils +RUN apt-get install -y kmod ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run -RUN sh /tmp/NVIDIA-DRIVER.run -a -N --ui=none --no-kernel-module +RUN sh /tmp/NVIDIA-DRIVER.run -s -N --ui=none --no-kernel-module RUN rm /tmp/NVIDIA-DRIVER.run From 4d1e5c55ca33a0e942cbe5b1d33b333f7b2cb19b Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 22 Jun 2016 08:55:42 -0400 Subject: [PATCH 02/11] Change to auto-detect NVidia driver version and download the appropriate .run from their site.. --- ubuntuWithNvidiaDriver/Dockerfile | 3 +-- ubuntuWithNvidiaDriver/build.sh | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 25b393d..6a92f1f 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -5,8 +5,7 @@ RUN apt-get update RUN apt-get install -y mesa-utils # install nvidia driver -RUN apt-get install -y binutils -RUN apt-get install -y kmod +RUN apt-get install -y binutils less x11-apps kmod ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run RUN sh /tmp/NVIDIA-DRIVER.run -s -N --ui=none --no-kernel-module RUN rm /tmp/NVIDIA-DRIVER.run diff --git a/ubuntuWithNvidiaDriver/build.sh b/ubuntuWithNvidiaDriver/build.sh index b80b939..f0cffad 100755 --- a/ubuntuWithNvidiaDriver/build.sh +++ b/ubuntuWithNvidiaDriver/build.sh @@ -1,7 +1,13 @@ #!/bin/sh IMAGE_NAME=ubuntu_with_nvidia_driver -NVIDIA_DRIVER=NVIDIA-Linux-x86_64-337.12.run # path to nvidia driver - -cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run +NVIDIA_VERSION=$(/sbin/modinfo -F version nvidia) +# path to nvidia driver +NVIDIA_DRIVER=NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run +if [ -f ${NVIDIA_DRIVER} ]; then + cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run +else + wget -O ${NVIDIA_DRIVER} http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VERSION}/${NVIDIA_DRIVER} && \ + cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run || exit 127 +fi sudo docker build -t ${IMAGE_NAME} . From b23939ecb11c5f8d3cef9f16c903afaf266f8260 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 22 Jun 2016 14:46:50 -0400 Subject: [PATCH 03/11] Make the default user unprivileged --- ubuntuWithNvidiaDriver/Dockerfile | 5 ++++- ubuntuWithNvidiaDriver/run.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 6a92f1f..0050f82 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -5,7 +5,10 @@ RUN apt-get update RUN apt-get install -y mesa-utils # install nvidia driver -RUN apt-get install -y binutils less x11-apps kmod +RUN apt-get install -y binutils less x11-apps kmod sudo apt-utils ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run RUN sh /tmp/NVIDIA-DRIVER.run -s -N --ui=none --no-kernel-module RUN rm /tmp/NVIDIA-DRIVER.run +RUN adduser --disabled-password --gecos '' user1 +RUN adduser user1 sudo +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index 9fec378..dfd9a71 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -3,4 +3,4 @@ COMMAND=/bin/bash xhost + # allow connections to X server -docker run --privileged -e "DISPLAY=unix:0.0" -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -i -t ubuntu_with_nvidia_driver $COMMAND +docker run --privileged -e "DISPLAY=unix:0.0" -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -i -t ubuntu_with_nvidia_driver sudo su - user1 From 3408872ac76a8b5e5c125fc2c34825c036d91acc Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 22 Jun 2016 15:05:57 -0400 Subject: [PATCH 04/11] Do not set the hostname... --- ubuntuWithNvidiaDriver/Dockerfile | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 0050f82..2fdffd9 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -1,5 +1,5 @@ FROM ubuntu -MAINTAINER github/gklingler +MAINTAINER github/ElCoyote27 RUN apt-get update RUN apt-get install -y mesa-utils @@ -7,8 +7,31 @@ RUN apt-get install -y mesa-utils # install nvidia driver RUN apt-get install -y binutils less x11-apps kmod sudo apt-utils ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run + +# Run NVidia driver install RUN sh /tmp/NVIDIA-DRIVER.run -s -N --ui=none --no-kernel-module RUN rm /tmp/NVIDIA-DRIVER.run -RUN adduser --disabled-password --gecos '' user1 -RUN adduser user1 sudo + +# Add 'worker' user +RUN adduser --disabled-password --gecos 'Runtime user' worker +RUN adduser worker sudo RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# allow the worker user to access video devices +RUN usermod -a -G video worker + +WORKDIR /home/worker +# are taken from GNU su manual +ENV HOME /home/worker +ENV SHELL /bin/bash +ENV USER worker +ENV LOGNAME worker +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +# This helps not forgetting setting DISPLAY=:0 when running +# tests outside of test.sh +ENV DISPLAY :0 + +# Set a default command useful for debugging +CMD ["/bin/bash", "--login"] From 8944ce3e069ba74945e14e5cbd8749d961eb7dd8 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 22 Jun 2016 15:06:17 -0400 Subject: [PATCH 05/11] N/A --- ubuntuWithNvidiaDriver/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index dfd9a71..5df0b2d 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -3,4 +3,4 @@ COMMAND=/bin/bash xhost + # allow connections to X server -docker run --privileged -e "DISPLAY=unix:0.0" -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -i -t ubuntu_with_nvidia_driver sudo su - user1 +docker run --privileged -e "DISPLAY=unix:0.0" -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -i -t ubuntu_with_nvidia_driver sudo su - worker From e57741b653bb4c7d80ea0458f565355a9c7f0a61 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Tue, 28 Mar 2017 16:58:28 -0400 Subject: [PATCH 06/11] Just in case DISPLAY is missing.... --- ubuntuWithNvidiaDriver/run.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index 5df0b2d..7b8e699 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -2,5 +2,16 @@ COMMAND=/bin/bash -xhost + # allow connections to X server -docker run --privileged -e "DISPLAY=unix:0.0" -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -i -t ubuntu_with_nvidia_driver sudo su - worker +if [ "x${DISPLAY}" = "x" ]; then + docker run --privileged \ + -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + -v="/var/tmp:/var/tmp:rw" \ + -i -t docker3d sudo su - worker +else + xhost + # allow connections to X server + docker run --privileged \ + -e "DISPLAY=unix:$(echo ${DISPLAY}|cut -d: -f2)" \ + -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + -v="/var/tmp:/var/tmp:rw" \ + -i -t docker3d sudo su - worker +fi From b2105384b1ed76f5a3088b316092469aef80bb67 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Tue, 28 Mar 2017 16:59:10 -0400 Subject: [PATCH 07/11] Use a different name for this container... --- ubuntuWithNvidiaDriver/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntuWithNvidiaDriver/build.sh b/ubuntuWithNvidiaDriver/build.sh index f0cffad..95d5539 100755 --- a/ubuntuWithNvidiaDriver/build.sh +++ b/ubuntuWithNvidiaDriver/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -IMAGE_NAME=ubuntu_with_nvidia_driver +IMAGE_NAME=docker3d NVIDIA_VERSION=$(/sbin/modinfo -F version nvidia) # path to nvidia driver NVIDIA_DRIVER=NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run From 982b74f4487df75e3984cee9df894159220279e0 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Tue, 9 May 2017 16:29:16 -0400 Subject: [PATCH 08/11] Revamp and fixes... --- ubuntuWithNvidiaDriver/Dockerfile | 18 +++++++++++++++--- ubuntuWithNvidiaDriver/build.sh | 6 +++--- ubuntuWithNvidiaDriver/run.sh | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 2fdffd9..1b25125 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -1,11 +1,21 @@ -FROM ubuntu +FROM ubuntu:16.04 MAINTAINER github/ElCoyote27 +ENV http_proxy "http://imladris.lasthome.solace.krynn:3128" +ENV ftp_proxy "http://imladris.lasthome.solace.krynn:3128" +ENV https_proxy "http://imladris.lasthome.solace.krynn:3128" +ENV no_proxy "localhost.localdomain,localhost,127.0.0.1,.localdomain4,localhost4,.localdomain6,localhost6,.lasthome.solace.krynn" + +# Workaround for issues with mirrors.. +RUN echo 'options ndots:2 timeout:2 attempts:2 single-request' >> /etc/resolv.conf +# RUN echo 'Acquire::http::Proxy "http://imladris.lasthome.solace.krynn:3128";' >> /etc/apt/apt.conf.d/01-vendor-ubuntu +# RUN sed -i s/http/ftp/ /etc/apt/sources.list + RUN apt-get update RUN apt-get install -y mesa-utils # install nvidia driver -RUN apt-get install -y binutils less x11-apps kmod sudo apt-utils +RUN apt-get install -y sudo binutils less x11-apps kmod apt-utils python python-tk pkg-config nano iproute ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run # Run NVidia driver install @@ -31,7 +41,9 @@ ENV LC_ALL en_US.UTF-8 # This helps not forgetting setting DISPLAY=:0 when running # tests outside of test.sh -ENV DISPLAY :0 +#ENV DISPLAY :0 + +USER worker # Set a default command useful for debugging CMD ["/bin/bash", "--login"] diff --git a/ubuntuWithNvidiaDriver/build.sh b/ubuntuWithNvidiaDriver/build.sh index 95d5539..afe563e 100755 --- a/ubuntuWithNvidiaDriver/build.sh +++ b/ubuntuWithNvidiaDriver/build.sh @@ -5,9 +5,9 @@ NVIDIA_VERSION=$(/sbin/modinfo -F version nvidia) # path to nvidia driver NVIDIA_DRIVER=NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run if [ -f ${NVIDIA_DRIVER} ]; then - cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run + echo "Using existing ${NVIDIA_DRIVER}..." else - wget -O ${NVIDIA_DRIVER} http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VERSION}/${NVIDIA_DRIVER} && \ - cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run || exit 127 + wget -O ${NVIDIA_DRIVER} http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VERSION}/${NVIDIA_DRIVER} || exit 127 fi +/bin/cp -f ${NVIDIA_DRIVER} NVIDIA-DRIVER.run sudo docker build -t ${IMAGE_NAME} . diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index 7b8e699..6fdec7a 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -8,7 +8,8 @@ if [ "x${DISPLAY}" = "x" ]; then -v="/var/tmp:/var/tmp:rw" \ -i -t docker3d sudo su - worker else - xhost + # allow connections to X server + #xhost + # allow connections to X server + xhost local:root docker run --privileged \ -e "DISPLAY=unix:$(echo ${DISPLAY}|cut -d: -f2)" \ -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ From cd261d16e2407fc1c416e18ae91039edc14bf9fa Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Tue, 9 May 2017 16:41:53 -0400 Subject: [PATCH 09/11] add user... --- ubuntuWithNvidiaDriver/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index 6fdec7a..013b220 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -6,7 +6,7 @@ if [ "x${DISPLAY}" = "x" ]; then docker run --privileged \ -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ -v="/var/tmp:/var/tmp:rw" \ - -i -t docker3d sudo su - worker + -i -t -u worker docker3d else #xhost + # allow connections to X server xhost local:root @@ -14,5 +14,5 @@ else -e "DISPLAY=unix:$(echo ${DISPLAY}|cut -d: -f2)" \ -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ -v="/var/tmp:/var/tmp:rw" \ - -i -t docker3d sudo su - worker + -i -t -u worker docker3d fi From f964d39397ae5a0e0296d5bc4ec14370caf91370 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Mon, 18 Sep 2017 22:13:04 -0400 Subject: [PATCH 10/11] Initial working version... --- ubuntuWithNvidiaDriver/Dockerfile | 16 ++++++++++++---- ubuntuWithNvidiaDriver/build.sh | 3 ++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 1b25125..4977d50 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -7,17 +7,25 @@ ENV https_proxy "http://imladris.lasthome.solace.krynn:3128" ENV no_proxy "localhost.localdomain,localhost,127.0.0.1,.localdomain4,localhost4,.localdomain6,localhost6,.lasthome.solace.krynn" # Workaround for issues with mirrors.. -RUN echo 'options ndots:2 timeout:2 attempts:2 single-request' >> /etc/resolv.conf -# RUN echo 'Acquire::http::Proxy "http://imladris.lasthome.solace.krynn:3128";' >> /etc/apt/apt.conf.d/01-vendor-ubuntu +# RUN echo 'options ndots:2 timeout:2 attempts:2 single-request' >> /etc/resolv.conf +RUN echo 'Acquire::http::Proxy "http://imladris.lasthome.solace.krynn:3128";' >> /etc/apt/apt.conf.d/01-vendor-ubuntu # RUN sed -i s/http/ftp/ /etc/apt/sources.list RUN apt-get update RUN apt-get install -y mesa-utils +RUN apt-get install -y sudo binutils less x11-apps kmod apt-utils python python-tk pkg-config nano iproute wget + +# Google Chrome +WORKDIR /tmp +#RUN apt-get install -y libxss1 libappindicator1 libindicator7 +ADD google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb +#RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +#RUN dpkg -i /tmp/google-chrome-stable_current_amd64.deb +RUN sudo apt-get install -f -y /tmp/google-chrome-stable_current_amd64.deb + # install nvidia driver -RUN apt-get install -y sudo binutils less x11-apps kmod apt-utils python python-tk pkg-config nano iproute ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run - # Run NVidia driver install RUN sh /tmp/NVIDIA-DRIVER.run -s -N --ui=none --no-kernel-module RUN rm /tmp/NVIDIA-DRIVER.run diff --git a/ubuntuWithNvidiaDriver/build.sh b/ubuntuWithNvidiaDriver/build.sh index afe563e..62e042a 100755 --- a/ubuntuWithNvidiaDriver/build.sh +++ b/ubuntuWithNvidiaDriver/build.sh @@ -10,4 +10,5 @@ else wget -O ${NVIDIA_DRIVER} http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VERSION}/${NVIDIA_DRIVER} || exit 127 fi /bin/cp -f ${NVIDIA_DRIVER} NVIDIA-DRIVER.run -sudo docker build -t ${IMAGE_NAME} . +######sudo docker build -t ${IMAGE_NAME} . +docker build -t ${IMAGE_NAME} . From 036ba40fc62ba6b7cd87eb350d69669bea8f5a93 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Fri, 13 Apr 2018 22:52:06 -0400 Subject: [PATCH 11/11] Update_on_el_7.5 --- ubuntuWithNvidiaDriver/Dockerfile | 11 ++++++++--- ubuntuWithNvidiaDriver/run.sh | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ubuntuWithNvidiaDriver/Dockerfile b/ubuntuWithNvidiaDriver/Dockerfile index 4977d50..dac187d 100644 --- a/ubuntuWithNvidiaDriver/Dockerfile +++ b/ubuntuWithNvidiaDriver/Dockerfile @@ -15,14 +15,19 @@ RUN apt-get update RUN apt-get install -y mesa-utils RUN apt-get install -y sudo binutils less x11-apps kmod apt-utils python python-tk pkg-config nano iproute wget +RUN apt-get update + +RUN apt-get install -y rss-glx + # Google Chrome WORKDIR /tmp #RUN apt-get install -y libxss1 libappindicator1 libindicator7 +RUN wget -qO google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb ADD google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb -#RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -#RUN dpkg -i /tmp/google-chrome-stable_current_amd64.deb -RUN sudo apt-get install -f -y /tmp/google-chrome-stable_current_amd64.deb +RUN apt-get update +#RUN sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb +RUN sudo apt-get install -y /tmp/google-chrome-stable_current_amd64.deb # install nvidia driver ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run diff --git a/ubuntuWithNvidiaDriver/run.sh b/ubuntuWithNvidiaDriver/run.sh index 013b220..6ffabac 100755 --- a/ubuntuWithNvidiaDriver/run.sh +++ b/ubuntuWithNvidiaDriver/run.sh @@ -10,7 +10,7 @@ if [ "x${DISPLAY}" = "x" ]; then else #xhost + # allow connections to X server xhost local:root - docker run --privileged \ + docker run --privileged --rm \ -e "DISPLAY=unix:$(echo ${DISPLAY}|cut -d: -f2)" \ -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ -v="/var/tmp:/var/tmp:rw" \