Guest User

Untitled

a guest
Jun 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. sudo add-apt-repository ppa:graphics-drivers/ppa
  2. sudo apt-get update
  3. sudo apt-get install nvidia-XXX # replace XXX with the same version your computer is running!
  4.  
  5. # current uid and gid
  6. curr_uid=`id -u`
  7. curr_gid=`id -g`
  8.  
  9. # create bb.dockerfile:
  10. cat << EOF2 > bb.dockerfile
  11. FROM ubuntu:xenial-20180417
  12. ARG UNAME=testuser
  13. ARG UID=1000
  14. ARG GID=1000
  15. RUN groupadd -g $GID $UNAME
  16. RUN useradd -m -u $UID -g $GID -s /bin/bash $UNAME
  17.  
  18. RUN apt-get update
  19. RUN apt-get install -y openssh-server openssh-client iputils-ping sudo
  20. RUN apt-get install -y lsb-release libgtk2.0 xterm vim rsync sshpass
  21. RUN mkdir /var/run/sshd
  22. RUN echo 'testuser:screencast' | chpasswd
  23. RUN sed -i -e '/sudo/ s/$/testuser/' /etc/group
  24.  
  25. ENV NOTVISIBLE "in users profile"
  26. RUN echo "export VISIBLE=now" >> /etc/profile
  27.  
  28. EXPOSE 22
  29. CMD ["/usr/sbin/sshd", "-D"]
  30. EOF2
  31.  
  32. docker build --build-arg UID=${curr_uid} --build-arg GID=${curr_gid}
  33. -f bb.dockerfile -t testimg .
  34.  
  35. USER $UNAME
  36. CMD /bin/bash
  37.  
  38. docker run -it -d
  39. -v /tmp/.X11-unix:/tmp/.X11-unix
  40. -v $HOME:/home/testuser
  41. -p 2022:22
  42. --name testcontainer -P testimg
  43.  
  44. ssh -l testuser -p 2022 -X localhost
Add Comment
Please, Sign In to add comment