Guest User

Centos7-base2

a guest
Nov 14th, 2020
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. xhost +local:root
  4.  
  5. docker network ls | grep hostonly > /dev/null 2>&1
  6.  
  7. if [ $? -ne 0 ]; then
  8.  
  9. echo Create host-only network for docker
  10.  
  11. docker network create -d bridge --internal hostonly
  12.  
  13. fi
  14.  
  15. #user should be a member of video and render to get full access to gpu
  16.  
  17. # export XAUTH_PROTO=$(xauth list | grep \hostname -s` | grep :0 |tail -1 |cut -d' ' -f3)`)
  18.  
  19. # export XAUTH_KEY=$(xauth list | grep \hostname -s` | grep :0 |tail -1 |cut -d' ' -f5)`)
  20.  
  21. #Do xauth list | grep unix:0
  22.  
  23. #inside docker shell xauth add :0 MIT-MAGIC... digest..
  24.  
  25. IMAGE=c7-coreplus:ver2
  26.  
  27. # --volume="/opt:/opt" \
  28.  
  29. GIDS=( $(id -G) ) #All of my groups
  30.  
  31. unset GIDS[0] #remove primary group
  32.  
  33. for g in "${GIDS[@]}"
  34.  
  35. do
  36.  
  37. G+=" --group-add=$g"
  38.  
  39. done
  40.  
  41.  
  42.  
  43. #RM=""
  44.  
  45. RM=" --rm "
  46.  
  47.  
  48.  
  49. U=""
  50.  
  51. #U=" --user $(id -u):$(id -g) $G"
  52.  
  53.  
  54.  
  55. VOLS=' --volume=/etc/group:/etc/group:ro '
  56.  
  57. VOLS+='--volume=/etc/passwd:/etc/passwd:ro '
  58.  
  59. VOLS+='--volume=/etc/shadow:/etc/shadow:ro '
  60.  
  61. VOLS+='--volume=/etc/sudoers.d:/etc/sudoers.d:ro '
  62.  
  63. VOLS+='--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw '
  64.  
  65. VOLS+="--volume=/home:/home "
  66.  
  67. VOLS+='--volume=/opt:/opt '
  68.  
  69. VOLS+='--volume=/run/media/fedora-vm:/mnt '
  70.  
  71. VOLS+="--device=/dev/dri "
  72.  
  73. VOLS+="--device=/dev/vga_arbiter "
  74.  
  75. NVS=( $(ls /dev/nvidia* 2>/dev/null) )
  76.  
  77. for N in "${NVS[@]}"
  78.  
  79. do
  80.  
  81. VOLS+="--device=$N "
  82.  
  83. done
  84.  
  85. #SEC=' --security-opt=label=disable --security-opt=seccomp=unconfined '
  86.  
  87. SEC=''
  88.  
  89. NET='--network=host '
  90.  
  91. docker run $RM -it --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro $U --env="DISPLAY" $VOLS -w="/home/${USER}" --ipc="host" $NET -w="/home/$USER" --hostname="localhost" --name="CentOS7" ${IMAGE} /usr/sbin/init
  92. # EOF
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×