Skip to content

Instantly share code, notes, and snippets.

@Nicnl
Created October 1, 2018 10:56
Show Gist options
  • Save Nicnl/5692c019811a75c3dd529e65dcf577c7 to your computer and use it in GitHub Desktop.
Save Nicnl/5692c019811a75c3dd529e65dcf577c7 to your computer and use it in GitHub Desktop.
VMware Workstation Dockerized
#!/bin/bash
set -e
docker build -t vmware .
set +e
docker kill vmware-workstation > /dev/null
docker rm vmware-workstation > /dev/null
set -e
docker run -ti --net=host --privileged --cap-add=ALL \
--name vmware-workstation \
-e DISPLAY=$DISPLAY \
-e EXEC_UID=$(id -u) \
-v /home/$(whoami)/.Xauthority:/root/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /etc/passwd:/etc/passwd:ro \
-v /lib/modules:/lib/modules \
-v /usr/src:/usr/src \
-v $(ls -d /usr/lib/linux-kbuild-*):$(ls -d /usr/lib/linux-kbuild-*) \
-v /home/$(whoami):/home/$(whoami) \
vmware
FROM debian:9
RUN apt-get -y update && apt-get -y install dbus-x11 zenity libnotify-cil-dev kmod build-essential gksu
#RUN apt-get -y update && apt-get -y install dbus-x11 zenity xterm firefox nano libnotify-cil-dev
ADD VMware-Workstation-Full-12.5.7-5813279.x86_64.bundle .
RUN ./VMware-Workstation-Full-12.5.7-5813279.x86_64.bundle --eulas-agreed --required
RUN rm VMware-Workstation-Full-12.5.7-5813279.x86_64.bundle
ADD entrypoint.sh /root/entrypoint.sh
RUN chmod +x /root/entrypoint.sh
RUN apt-get -y install python2.7
#RUN ln -s $(which python2.7) /usr/bin/python2
ADD https://bootstrap.pypa.io/get-pip.py /root/get-pip.py
RUN python2.7 /root/get-pip.py
RUN python2.7 -m pip install six
ADD unlocker /root/unlocker
RUN cd /root/unlocker && bash /root/unlocker/lnx-install.sh
RUN mv /root/unlocker/tools /usr/share/vmware_tools && chmod 555 /usr/share/vmware_tools && chmod 444 /usr/share/vmware_tools/*
ENTRYPOINT ["bash", "/root/entrypoint.sh"]
#ENTRYPOINT ["bash"]
#!/bin/bash
vmware_check_file=.vmware_installed
if [ ! -f $vmware_check_file ]; then
vmware-modconfig --console --install-all
touch $vmware_check_file
echo "root:root" | chpasswd
zenity --info --text="Enter a license key. If asked for a root password, type \"root\"."
else
service vmware start
fi
su $(id -nu $EXEC_UID) -c vmware
#!/bin/sh
docker start vmware-workstation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment