Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is what happens :
- root@Z390-AORUS-PRO:/home/ziomario/Scrivania/Virt/dockers/ziomario-docker# ./run.sh
- Hello, whats your user name ?mario
- mario
- No qcow2 Filesystem detected at /home/mario/budgieVM.qcow2!
- No zipped Filesystem detected at /home/mario/budgieVM.zip!
- you knoow why ? I imagine that the reason is because the value of $username is empty.
- VOLUME /home/$username
- COPY start.sh /start.sh
- ENTRYPOINT \["/start.sh"\]
- it's the same if I do :
- VOLUME /home
- COPY start.sh /start.sh
- ENTRYPOINT \["/start.sh"\]
- because it copies the file on /home,but I want it on /home/$username
- let's recap. this is how is configured everything :
- Dockerfile
- RUN chmod +x /usr/local/bin/firefox && \
- echo "$username:x:1000:1000:Usernames,,,:/home/$username:/bin/bash" >> /etc/passwd && \
- echo "$username:x:1000:" >> /etc/group && \
- echo "$username ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d && \
- chmod 0440 /etc/sudoers.d && \
- chown $username:$username -R /home/$username
- ARG FILESYSTEM_IMAGE_URL="http://ziomario.ns0.it/budgieVM.zip"
- ADD $FILESYSTEM_IMAGE_URL /home/$username/budgieVM.zip
- VOLUME /home
- COPY start.sh /start.sh
- ENTRYPOINT ["/start.sh"]
- start.sh
- /bin/bash
- #rm hostusername 2> /dev/null
- hostusername=$(whoami)
- echo $hostusername
- #echo "$hostusername" > "hostusername"
- #rm username 2> /dev/null
- echo -n " Hello, whats your username ?"
- read -r
- username=$REPLY
- echo $username
- #echo "$username" > "username"
- mkdir -p /home/$username
- image_path="/home/$username/budgieVM.qcow2"
- zip_path="/home/$username/budgieVM.zip"
- if [ ! -e $image_path ]; then
- echo "No qcow2 Filesystem detected at ${image_path}!"
- if [ -e $zip_path ]; then
- echo "Extracting fresh filesystem..."
- unzip $zip_path
- mv -- *.img $image_path
- else
- echo "No zipped Filesystem detected at ${zip_path}!"
- exit 1
- fi
- fi
- echo "Extracting fresh filesystem..."
- #!/bin/bash
- run.sh
- XSOCK=/tmp/.X11-unix
- XAUTH=/tmp/.docker.xauth
- touch $XAUTH
- xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
- docker run \
- --gpus all \
- --rm -it \
- -v $XSOCK:$XSOCK:rw \
- -v $XAUTH:$XAUTH:rw \
- -e DISPLAY=$DISPLAY \
- -e XAUTHORITY=$XAUTH \
- -v /:/home/$username/Shared-$hostusername \
- -t ziomario/docker
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement