Skip to content

Instantly share code, notes, and snippets.

@royshil royshil/
Last active Jan 27, 2018

What would you like to do?
Setup an automatic Tensorflow-CUDA-Docker-Jupyter machine on Google Cloud Platform
# First you must install the 4.4.0 kernel:
# $ sudo apt-get install linux-image-4.4.0-112-generic
# find all the other kernels and remove them:
# $ sudo apt-get purge linux-image-4.13.0-1008-gcp
# $ sudo update-grub
# $ sudo reboot
sudo apt-get update && sudo apt-get install -y \
build-essential \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
linux-headers-$(uname -r)
#### Install Nvidia CUDA
wget -nc
sudo sh cuda_9.1.85_387.26_linux -silent
rm -rf cuda_9.1.85_387.26_linux
#### Install Docker
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get install -y docker-ce
#### Install Nvidia Docker
curl -s -L | sudo apt-key add -
curl -s -L | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get -qq update
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
#### Build Docker image
cat << EOF > Dockerfile.tensorflow_gpu_jupyter
FROM tensorflow/tensorflow:latest-gpu
RUN apt-get update && apt-get install -y python-opencv python-skimage git
RUN pip install requests ipywidgets seaborn
RUN jupyter nbextension enable --py widgetsnbextension
RUN git clone git:// && pip install keras[tests] && rm -rf keras
CMD ["/", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password='sha1:c05e4b238956:8ac2f926ab754e180ec201ce0485b2a55f679ceb'"]
sudo docker build -t tensorflow_gpu_jupyter -f Dockerfile.tensorflow_gpu_jupyter .
sudo nvidia-docker run -dit --restart unless-stopped -p 8888:8888 tensorflow_gpu_jupyter
echo "The password to the notebook is 'tensorflow_gpu_jupyter'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.